mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 19:22:46 +08:00
zap
This commit is contained in:
parent
22633cbe77
commit
3202b6869d
@ -64,8 +64,8 @@ type ZapLogger struct {
|
||||
|
||||
func NewZapLogger(logLevel int, isStdout bool, isJson bool, logLocation string, rotateCount uint) (*ZapLogger, error) {
|
||||
zapConfig := zap.Config{
|
||||
Level: zap.NewAtomicLevelAt(logLevelMap[logLevel]),
|
||||
EncoderConfig: zap.NewProductionEncoderConfig(),
|
||||
Level: zap.NewAtomicLevelAt(logLevelMap[logLevel]),
|
||||
// EncoderConfig: zap.NewProductionEncoderConfig(),
|
||||
// InitialFields: map[string]interface{}{"PID": os.Getegid()},
|
||||
DisableStacktrace: true,
|
||||
}
|
||||
@ -109,7 +109,8 @@ func (l *ZapLogger) cores(logLevel int, isStdout bool, isJson bool, logLocation
|
||||
} else {
|
||||
c.EncodeLevel = l.CapitalColorLevelEncoder
|
||||
customCallerEncoder := func(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {
|
||||
enc.AppendString("[" + caller.TrimmedPath() + "]")
|
||||
s := "[" + caller.TrimmedPath() + "]"
|
||||
enc.AppendString(_levelToColor[l.zap.Level()].Add(s))
|
||||
}
|
||||
c.EncodeCaller = customCallerEncoder
|
||||
fileEncoder = zapcore.NewConsoleEncoder(c)
|
||||
|
Loading…
x
Reference in New Issue
Block a user