Documentation
¶
Index ¶
- func DPanic(msg string, fields ...zap.Field)
- func Debug(msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func Fatal(msg string, fields ...zap.Field)
- func Info(msg string, fields ...zap.Field)
- func Init(cfg *ZapLogConfig)
- func NewZapLog(cfg *ZapLogConfig) *zap.Logger
- func Panic(msg string, fields ...zap.Field)
- func Warn(msg string, fields ...zap.Field)
- func With(fields ...zap.Field) *zap.Logger
- func WithCtx(ctx context.Context) *zap.Logger
- func WithOptions(opts ...zap.Option) *zap.Logger
- type ZapLogConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(cfg *ZapLogConfig)
Types ¶
type ZapLogConfig ¶
type ZapLogConfig struct {
// 指定日志的文件名
Filename string `json:"filename" yaml:"filename"`
// 日志级别, 可选值为 debug、info、warn、error、dpanic、panic、fatal
Level string `json:"level" yaml:"level"`
// 日志格式, 可选值为 json 或 console
Format string `json:"format" yaml:"format"`
MaxAge int `json:"max_age" yaml:"max_age"`
// 指定日志文件的最大值
MaxSize int `json:"max_size" yaml:"max_size"`
// 指定日志文件的备份
MaxBackups int `json:"max_backups" yaml:"max_backups"`
Compress bool `json:"compress" yaml:"compress"`
// 上下文里提取的key信息, 比如trace_id。这些信息会自动的加入log里
CtxKeys []string `json:"ctx_keys" yaml:"ctx_keys"`
}
ZapLogConfig zap日志配置参数
Click to show internal directories.
Click to hide internal directories.