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) 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 string) context.Context
- func SetFormatter(format string)
- func SetLevel(level int)
- func SetOutput(out io.Writer)
- func SetVersion(v string)
- type Entry
- type Hook
- type Logger
Constants ¶
View Source
const ( TraceIDKey = "trace_id" UserIDKey = "user_id" TagKey = "tag" VersionKey = "version" StackKey = "stack" )
Define key
Variables ¶
View Source
var ( Trace = logrus.Trace Tracef = logrus.Tracef Debug = logrus.Debug Debugf = logrus.Debugf Info = logrus.Info Infof = logrus.Infof Warn = logrus.Warn Warnf = logrus.Warnf Error = logrus.Error Errorf = logrus.Errorf Fatal = logrus.Fatal Fatalf = logrus.Fatalf Panic = logrus.Panic Panicf = logrus.Panicf Print = logrus.Print Printf = logrus.Printf )
Define logrus alias
Functions ¶
func FromStackContext ¶
FromStackContext 从上下文中获取Stack
func FromTraceIDContext ¶
FromTraceIDContext 从上下文中获取跟踪ID
func FromUserIDContext ¶
FromUserIDContext 从上下文中获取用户ID
func NewStackContext ¶
NewStackContext 创建Stack上下文
func NewTagContext ¶
NewTagContext 创建Tag上下文
func NewTraceIDContext ¶
NewTraceIDContext 创建跟踪ID上下文
func NewUserIDContext ¶
NewUserIDContext 创建用户ID上下文
Types ¶
Click to show internal directories.
Click to hide internal directories.