mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-28 04:48:44 +08:00
zap
This commit is contained in:
parent
1a56deeb21
commit
0d3a1ba6f6
@ -92,15 +92,17 @@ func (l *ZapLogger) cores(logLevel int, isStdout bool, isJson bool) (zap.Option,
|
||||
c := zap.NewProductionEncoderConfig()
|
||||
c.EncodeTime = zapcore.ISO8601TimeEncoder
|
||||
c.EncodeDuration = zapcore.SecondsDurationEncoder
|
||||
c.EncodeLevel = zapcore.CapitalLevelEncoder
|
||||
|
||||
c.MessageKey = "msg"
|
||||
c.LevelKey = "level"
|
||||
c.TimeKey = "time"
|
||||
c.CallerKey = "caller"
|
||||
var fileEncoder zapcore.Encoder
|
||||
if isJson {
|
||||
c.EncodeLevel = zapcore.CapitalLevelEncoder
|
||||
fileEncoder = zapcore.NewJSONEncoder(c)
|
||||
} else {
|
||||
c.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
||||
fileEncoder = zapcore.NewConsoleEncoder(c)
|
||||
}
|
||||
fileEncoder.AddInt("PID", os.Getpid())
|
||||
|
Loading…
x
Reference in New Issue
Block a user