Documentation ¶
Index ¶
- Constants
- func Debug(ctx context.Context, msg string, fields ...LogField)
- func Debugf(ctx context.Context, template string, args ...any)
- func Error(ctx context.Context, err error, fields ...LogField)
- func Errorf(ctx context.Context, template string, args ...any)
- func Fatal(ctx context.Context, msg string, fields ...LogField)
- func Fatalf(ctx context.Context, template string, args ...any)
- func Info(ctx context.Context, msg string, fields ...LogField)
- func Infof(ctx context.Context, template string, args ...any)
- func InitLogger(cfg LogConfig)
- func Panic(ctx context.Context, msg error, fields ...LogField)
- func Panicf(ctx context.Context, template string, args ...any)
- func Warn(ctx context.Context, msg string, fields ...LogField)
- func Warnf(ctx context.Context, template string, args ...any)
- type LogConfig
- type LogField
- func Any(key string, value interface{}) LogField
- func Bool(key string, val bool) LogField
- func ByteString(key string, val []byte) LogField
- func Duration(key string, val time.Duration) LogField
- func Float32(key string, val float32) LogField
- func Float64(key string, val float64) LogField
- func Int(key string, val int) LogField
- func Int32(key string, val int32) LogField
- func Int64(key string, val int64) LogField
- func String(key string, val string) LogField
- func Time(key string, val time.Time) LogField
- func Uintptr(key string, val uintptr) LogField
Constants ¶
View Source
const TraceId = "trace_id"
定义日志中traceid名称
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogConfig ¶
type LogConfig struct { Name string `mapstructure:"name"` Path string `mapstructure:"path"` Level string `mapstructure:"level"` MaxSize int `mapstructure:"max-size"` MaxBackups int `mapstructure:"max-backups"` MaxAge int `mapstructure:"max-age"` Compress bool `mapstructure:"compress"` }
日志配置
Click to show internal directories.
Click to hide internal directories.