修复日志配置处理错误问题

This commit is contained in:
白茶清欢 2022-06-23 10:27:56 +08:00
parent a5bde3ca5b
commit f5c7cd16ca

View File

@ -228,14 +228,15 @@ func (c *client) getLogInstance(logConf *logger.InputLogConfig) (*zap.Logger, er
var ( var (
err error err error
loggerInstance *zap.Logger loggerInstance *zap.Logger
splitConfig *logger.RotateLogConfig
) )
splitConfig := &logger.RotateLogConfig{ if splitConfig, err = logger.NewRotateLogConfig(
TimeIntervalType: logConf.TimeIntervalType, logConf.Path,
LogPath: logConf.Path, logConf.Name,
LogFileName: logConf.Name, logger.WithDivisionChar(logConf.DivisionChar),
DivisionChar: logConf.DivisionChar, logger.WithTimeIntervalType(logConf.TimeIntervalType),
FullLogFormat: logConf.Format, logger.WithMaxAge(time.Duration(logConf.MaxAge)*time.Second)); nil != err {
MaxAge: time.Duration(logConf.MaxAge) * time.Second, return nil, err
} }
if loggerInstance, err = logger.NewLogger(logConf.LogLevel, splitConfig, logConfList...); nil != err { if loggerInstance, err = logger.NewLogger(logConf.LogLevel, splitConfig, logConfList...); nil != err {
return nil, err return nil, err