lxLog

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StackdriverErrKey     = "@type"
	StackdriverErrorValue = "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent"
	LogLevelPanic         = "panic"
	LogLevelFatal         = "fatal"
	LogLevelError         = "error"
	LogLevelWarn          = "warn"
	LogLevelInfo          = "info"
	LogLevelDebug         = "debug"
	LogLevelTrace         = "trace"

	LogFormatText    = "text"
	LogFormatJson    = "json"
	LogFormatFluentd = "fluentd"

	FormatText OutFormat = iota + 1
	FormatJson
	FormatFluentd
)

Variables

This section is empty.

Functions

func GetLogger

func GetLogger() *logrus.Logger

GetLogger, return singleton logger instance Usage:

log := lxLog.GetLogger()

log.WithFields(logrus.Fields{
	"omg":                   true,
	"number":                100,
	lxLog.StackdriverErrKey: lxLog.StackdriverErrorValue,
}).Error("Error without Stack and stackdriver error event!")

func GetMessageWithStack added in v1.5.7

func GetMessageWithStack(message string) string

GetMessageWithStack, return message string with stack trace Usage:

log.WithFields(logrus.Fields{
	"omg":    true,
	"number": 100,
}).Error(lxLog.GetMessageWithStack("Error with Stack!"))

func HasInit added in v1.2.9

func HasInit() bool

func InitLogger added in v1.2.9

func InitLogger(output io.Writer, logLevel, logFormat string) (log *logrus.Logger)

InitLogger, setup the logger global Usage:

lxLog.InitLogger(os.Stdout, "debug", "text")

Types

type OutFormat added in v1.2.9

type OutFormat int

func GetOutFormat added in v1.2.9

func GetOutFormat() OutFormat

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL