test-errcode
wangchuxiao 2 years ago
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…
Cancel
Save