This commit is contained in:
wangchuxiao
2023-04-18 14:43:54 +08:00
parent a2e845ec9f
commit cfb600a632
4 changed files with 12 additions and 9 deletions
+1
View File
@@ -3,6 +3,7 @@ package log
import (
"bufio"
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
+2 -2
View File
@@ -95,14 +95,14 @@ func NewZapLogger(loggerName string, logLevel int, isStdout bool, isJson bool, l
}
func (l *ZapLogger) cores(isStdout bool, isJson bool, logLocation string, rotateCount uint) (zap.Option, error) {
c := zap.NewDevelopmentEncoderConfig()
c := zap.NewProductionEncoderConfig()
c.EncodeTime = l.timeEncoder
c.EncodeDuration = zapcore.SecondsDurationEncoder
c.MessageKey = "msg"
c.LevelKey = "level"
c.TimeKey = "time"
c.CallerKey = "caller"
c.NameKey = l.loggerName
var fileEncoder zapcore.Encoder
if isJson {
c.EncodeLevel = zapcore.CapitalLevelEncoder