mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 11:36:44 +08:00
zap
This commit is contained in:
parent
cce90a109d
commit
aed8536080
@ -103,11 +103,7 @@ func (l *ZapLogger) cores(logLevel int, isStdout bool, isJson bool, logLocation
|
||||
} else {
|
||||
c.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
||||
customCallerEncoder := func(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {
|
||||
enc.AppendString("[" + caller.Function + "]")
|
||||
enc.AppendString("[" + caller.TrimmedPath() + "]")
|
||||
enc.AppendString("[" + caller.String() + "]")
|
||||
enc.AppendString("[" + caller.File + "]")
|
||||
enc.AppendString("[" + caller.FullPath() + "]")
|
||||
}
|
||||
c.EncodeCaller = customCallerEncoder
|
||||
fileEncoder = zapcore.NewConsoleEncoder(c)
|
||||
@ -145,6 +141,11 @@ func (l *ZapLogger) getWriter(logLocation string, rorateCount uint) (zapcore.Wri
|
||||
return zapcore.AddSync(logf), nil
|
||||
}
|
||||
|
||||
func (l *ZapLogger) CapitalColorLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder) {
|
||||
zapcore.CapitalColorLevelEncoder(level, enc)
|
||||
enc.AppendString("caller")
|
||||
}
|
||||
|
||||
func (l *ZapLogger) ToZap() *zap.SugaredLogger {
|
||||
return l.zap
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user