Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode

# Conflicts:
#	pkg/common/mw/rpc_server_interceptor.go
This commit is contained in:
wangchuxiao 2023-03-14 20:30:04 +08:00
parent 6de048d84f
commit 3bc6e66b1a

View File

@ -70,6 +70,7 @@ func NewZapLogger() (*ZapLogger, error) {
return nil, err return nil, err
} }
zl.zap = l.Sugar() zl.zap = l.Sugar()
zl.zap.WithOptions(zap.AddStacktrace(zap.DPanicLevel))
return zl, nil return zl, nil
} }
@ -102,6 +103,14 @@ func (l *ZapLogger) cores() (zap.Option, error) {
}), nil }), nil
} }
func NewErrStackCore(c zapcore.Core) zapcore.Core {
return &errStackCore{c}
}
type errStackCore struct {
zapcore.Core
}
func (l *ZapLogger) getWriter() (zapcore.WriteSyncer, error) { func (l *ZapLogger) getWriter() (zapcore.WriteSyncer, error) {
logf, err := rotatelogs.New(config.Config.Log.StorageLocation+sp+"OpenIM.log.all"+".%Y-%m-%d", logf, err := rotatelogs.New(config.Config.Log.StorageLocation+sp+"OpenIM.log.all"+".%Y-%m-%d",
rotatelogs.WithRotationCount(config.Config.Log.RemainRotationCount), rotatelogs.WithRotationCount(config.Config.Log.RemainRotationCount),