Documentation ¶
Index ¶
- Constants
- func AddHook(hook Hook)
- func Debugf(ctx context.Context, format string, args ...interface{})
- func ErrorStack(ctx context.Context, err error)
- func Errorf(ctx context.Context, format string, args ...interface{})
- func Fatalf(ctx context.Context, format string, args ...interface{})
- func FromTraceIDContext(ctx context.Context) string
- func FromUserIDContext(ctx context.Context) string
- func Infof(ctx context.Context, format string, args ...interface{})
- func NewTraceIDContext(ctx context.Context, traceID string) context.Context
- func NewUserIDContext(ctx context.Context, userID string) context.Context
- func Printf(ctx context.Context, format string, args ...interface{})
- func SetFormatter(format string)
- func SetLevel(level int)
- func SetOutput(out io.Writer)
- func SetTraceIDFunc(fn TraceIDFunc)
- func SetVersion(v string)
- func Warnf(ctx context.Context, format string, args ...interface{})
- type Entry
- func (e *Entry) Debugf(format string, args ...interface{})
- func (e *Entry) Errorf(format string, args ...interface{})
- func (e *Entry) Fatalf(format string, args ...interface{})
- func (e *Entry) Infof(format string, args ...interface{})
- func (e *Entry) Printf(format string, args ...interface{})
- func (e *Entry) Warnf(format string, args ...interface{})
- func (e *Entry) WithField(key string, value interface{}) *Entry
- func (e *Entry) WithFields(fields map[string]interface{}) *Entry
- type Hook
- type Logger
- type SpanOption
- type TraceIDFunc
Constants ¶
View Source
const ( TraceIDKey = "trace_id" UserIDKey = "user_id" SpanTitleKey = "span_title" SpanFunctionKey = "span_function" VersionKey = "version" StackKey = "stack" )
定义键名
Variables ¶
This section is empty.
Functions ¶
func FromTraceIDContext ¶
FromTraceIDContext 从上下文中获取跟踪ID
func FromUserIDContext ¶
FromUserIDContext 从上下文中获取用户ID
func NewTraceIDContext ¶
NewTraceIDContext 创建跟踪ID上下文
func NewUserIDContext ¶
NewUserIDContext 创建用户ID上下文
Types ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry 定义统一的日志写入方式
func (*Entry) WithFields ¶
WithFields 结构化字段写入
Click to show internal directories.
Click to hide internal directories.