mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-03 08:35:59 +08:00
zap
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user