更新 redis log

This commit is contained in:
白茶清欢 2021-08-14 19:24:39 +08:00
parent 8cb936a57b
commit 35a75ea21e
2 changed files with 10 additions and 2 deletions

View File

@ -52,7 +52,7 @@ type RotateLogConfig struct {
MaxAge time.Duration `json:"max_age" yaml:"max_age"` // 日志最长保存时间 MaxAge time.Duration `json:"max_age" yaml:"max_age"` // 日志最长保存时间
} }
// SetRotateLogConfigOption 设置日志切割的选项 // SetRotateLogConfigFunc 设置日志切割的选项
// //
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>
// //

View File

@ -150,9 +150,17 @@ func (c *Client) getLogger(conf *LoggerConfig) (*zap.Logger, error) {
if conf.Encoder != nil { if conf.Encoder != nil {
optionFuncList = append(optionFuncList, logger.WithEncoder(conf.Encoder)) optionFuncList = append(optionFuncList, logger.WithEncoder(conf.Encoder))
} }
splitConfigFuncList := []logger.SetRotateLogConfigFunc{
logger.WithTimeIntervalType(conf.SplitConfig.TimeIntervalType),
logger.WithDivisionChar(conf.SplitConfig.DivisionChar),
logger.WithMaxAge(conf.SplitConfig.MaxAge),
}
splitConfig, _ := logger.NewRotateLogConfig(conf.SplitConfig.LogPath, conf.SplitConfig.LogFileName, splitConfigFuncList...)
return logger.NewLogger( return logger.NewLogger(
conf.LoggerLevel, conf.LoggerLevel,
conf.SplitConfig, splitConfig,
optionFuncList..., optionFuncList...,
) )
} }