Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DebugLevel = zapcore.DebugLevel // InfoLevel is the default logging priority. InfoLevel = zapcore.InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel = zapcore.WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel = zapcore.ErrorLevel // DPanicLevel logs are particularly important errors. In development the // logger panics after writing the message. DPanicLevel = zapcore.DPanicLevel // PanicLevel logs a message, then panics. PanicLevel = zapcore.PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel = zapcore.FatalLevel )
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { With(fields ...zap.Field) Logger Debug(msg string, fields ...zap.Field) Info(msg string, fields ...zap.Field) Warn(msg string, fields ...zap.Field) Error(msg string, fields ...zap.Field) DPanic(msg string, fields ...zap.Field) Panic(msg string, fields ...zap.Field) Fatal(msg string, fields ...zap.Field) Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) DPanicf(format string, args ...interface{}) Panicf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) // Flush 日志刷盘 Flush() // SetLevel 运行时修改日志级别 SetLevel(level Level) }
func NewConsole ¶
type Options ¶ added in v0.1.0
type Options struct { Level Level // 默认: InfoLevel LogFile string // 默认: ${home}/logs/${app} MaxSizeMB int // 默认: 12*1024, 2GB MaxBackups int // 默认:0,不限制 MaxDays int // 默认: 7 TimeEncoder TimeEncoder // 默认: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000") Thin bool // 是否只打印时间和传入内容,不包括其他额外字段,默认:否 }
Options 日志配置
type TimeEncoder ¶ added in v0.1.0
type TimeEncoder = zapcore.TimeEncoder
Click to show internal directories.
Click to hide internal directories.