Documentation ¶
Index ¶
- Constants
- func AddHook(hook Hook)
- func Debugf(ctx context.Context, format string, args ...interface{})
- func Errorf(ctx context.Context, format string, args ...interface{})
- func Fatalf(ctx context.Context, format string, args ...interface{})
- func FromSpanIDContext(ctx context.Context) string
- func FromTraceIDContext(ctx context.Context) string
- func FromUserIDContext(ctx context.Context) string
- func Infof(ctx context.Context, format string, args ...interface{})
- func NewSpanIDContext(ctx context.Context, spanID string) context.Context
- 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 StartSpanWithCall(ctx context.Context, opts ...SpanOption) func() *Entry
- 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) Finish()
- 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 ( StartedAtKey = "started_at" TraceIDKey = "trace_id" UserIDKey = "user_id" SpanIDKey = "span_id" SpanTitleKey = "span_title" SpanFunctionKey = "span_function" VersionKey = "version" TimeConsumingKey = "time_consuming" )
定义键名
Variables ¶
This section is empty.
Functions ¶
func FromSpanIDContext ¶
FromSpanIDContext 从上下文中获取跟踪单元ID
func FromTraceIDContext ¶
FromTraceIDContext 从上下文中获取跟踪ID
func FromUserIDContext ¶
FromUserIDContext 从上下文中获取用户ID
func NewSpanIDContext ¶
NewSpanIDContext 创建跟踪单元ID上下文
func NewTraceIDContext ¶
NewTraceIDContext 创建跟踪ID上下文
func NewUserIDContext ¶
NewUserIDContext 创建用户ID上下文
func StartSpanWithCall ¶
func StartSpanWithCall(ctx context.Context, opts ...SpanOption) func() *Entry
StartSpanWithCall 开始一个追踪单元(回调执行)
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.