Documentation ¶
Index ¶
- Constants
- Variables
- func AddHook(hook Hook)
- func FromStackContext(ctx context.Context) error
- func FromTagContext(ctx context.Context) string
- func FromTraceIDContext(ctx context.Context) string
- func FromUserIDContext(ctx context.Context) uint64
- func FromUserNameContext(ctx context.Context) string
- func NewStackContext(ctx context.Context, stack error) context.Context
- func NewTagContext(ctx context.Context, tag string) context.Context
- func NewTraceIDContext(ctx context.Context, traceID string) context.Context
- func NewUserIDContext(ctx context.Context, userID uint64) context.Context
- func NewUserNameContext(ctx context.Context, userName string) context.Context
- func SetFormatter(format string)
- func SetLevel(level Level)
- type Entry
- type Hook
- type Level
- type Logger
Constants ¶
View Source
const ( TraceIDKey = "trace_id" UserIDKey = "user_id" UserNameKey = "user_name" TagKey = "tag" StackKey = "stack" )
Define key
Variables ¶
View Source
var ( Tracef = logrus.Tracef Debugf = logrus.Debugf Infof = logrus.Infof Warnf = logrus.Warnf Errorf = logrus.Errorf Fatalf = logrus.Fatalf Panicf = logrus.Panicf Printf = logrus.Printf SetOutput = logrus.SetOutput SetReportCaller = logrus.SetReportCaller StandardLogger = logrus.StandardLogger ParseLevel = logrus.ParseLevel )
Define logrus alias
Functions ¶
func FromStackContext ¶
func FromTagContext ¶
func FromTraceIDContext ¶
func FromUserIDContext ¶
func FromUserNameContext ¶
func NewTraceIDContext ¶
func NewUserNameContext ¶
func SetFormatter ¶
func SetFormatter(format string)
SetFormatter Set logger output format (json/text)
Types ¶
Click to show internal directories.
Click to hide internal directories.