Documentation
¶
Index ¶
- Variables
- func IsDebugEnabled() bool
- func Log() *logrus.Logger
- func New() *logrus.Logger
- func RequestIDContext(ctx context.Context, id ...string) context.Context
- func SetFormatter(f string, pretty bool)
- func SetLevel(l string)
- func SetOutput(o string)
- func Writer(output string) io.Writer
- type Fields
- type Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Debug = log.Debug Debugf = log.Debugf Error = log.Error Errorf = log.Errorf Fatal = log.Fatal Fatalf = log.Fatalf Info = log.Info Infof = log.Infof Print = log.Print Printf = log.Printf Println = log.Println Trace = log.Trace Tracef = log.Tracef Warn = log.Warn Warnf = log.Warnf WithContext = log.WithContext WithError = log.WithError WithField = log.WithField WithFields = log.WithFields RegisterExitHandler = logrus.RegisterExitHandler )
define aliases to logrus.
View Source
var ( // JSONLogFormatter formats logs into parsable json. JSONLogFormatter = &logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000-07:00", CallerPrettyfier: callerPretty, DisableHTMLEscape: true} // TextLogFormatter formats logs into text. TextLogFormatter = &logrus.TextFormatter{TimestampFormat: "2006-01-02T15:04:05.000-07:00", FullTimestamp: true, CallerPrettyfier: callerPretty} )
Functions ¶
func IsDebugEnabled ¶
func IsDebugEnabled() bool
IsDebugEnabled checks if the log level is greater than the debug level.
func RequestIDContext ¶
RequestIDContext set request id to context. The requestIDHook will read it. If an empty id is passed in, a randomly one will be generated.
func SetFormatter ¶
SetFormatter sets the standard logger formatter.
Types ¶
Click to show internal directories.
Click to hide internal directories.