Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTraceContext ¶
NewTraceContext new context with a traceID
func WithContext ¶
WithContext 从指定的context返回一个zap实例(关键方法)
Types ¶
type Config ¶
type Config struct { Encoder string // 编码器: console, json Outputs []string // 日志输出方式 stdout, file Parameters struct { Level string // level 日志输出级别: e.g. debug, info, warn, error TraceLevel string // trace_level 是否开启错误上下文追踪 TimeEncoder string // time_encoder 时间编码器(时间格式) CallerEncoder string // caller_encoder 调用者格式 e.g. short, full FilePath string // file_path output包含file时需要此参数 } }
Config config
func ParseConfig ¶
ParseConfig parse config from dsn dsn e.g. console://[stdout,file]?level=debug&trace_level=error
type TraceIDKeyType ¶
type TraceIDKeyType string
TraceIDKeyType trace id key type
const ( // TraceIDKey trace id key TraceIDKey TraceIDKeyType = "traceId" )
Click to show internal directories.
Click to hide internal directories.