Documentation
¶
Index ¶
- Variables
- func Debug(msg string, fields ...zap.Field)
- func EncodeFields(encoder zapcore.Encoder, level zapcore.Level, msg string, ...) ([]byte, error)
- func Error(msg string, fields ...zap.Field)
- func Info(msg string, fields ...zap.Field)
- func IsDebug() bool
- func NewZapLoggerWithLumberjack(basePath string, enc zapcore.Encoder, ljOption *lumberjack.Logger) *zap.Logger
- func Warn(msg string, fields ...zap.Field)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultLevel = zap.InfoLevel DefaultLog = func(level zapcore.Level, msg string, fields ...zap.Field) { line, _ := EncodeFields(DefaultJsonEncoder, level, msg, fields...) if len(line) > 0 { fmt.Println(bytes2String(line)) } } )
View Source
var ( DefaultJsonEncoder = zapcore.NewJSONEncoder( zapcore.EncoderConfig{ MessageKey: "Message", LevelKey: "Level", TimeKey: "DateTime", EncodeTime: func(t time.Time, enc zapcore.PrimitiveArrayEncoder) { enc.AppendString(t.Format("2006-01-02 15:04:05")) }, EncodeLevel: zapcore.CapitalLevelEncoder, CallerKey: "File", EncodeCaller: zapcore.ShortCallerEncoder, }, ) )
Functions ¶
func EncodeFields ¶
func NewZapLoggerWithLumberjack ¶ added in v3.0.12
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.