fix both modify
This commit is contained in:
commit
fff01c4405
16
define.go
16
define.go
@ -22,7 +22,6 @@ import (
|
||||
type InputLogConfig struct {
|
||||
Name string `json:"name" yaml:"name"` // 日志文件名
|
||||
Path string `json:"path" yaml:"path"` // 日志文件路径
|
||||
Format string `json:"format" yaml:"format"` // 文件格式
|
||||
TimeIntervalType TimeIntervalType `json:"time_interval_type" yaml:"time_interval_type"` // 日志切割规则
|
||||
DivisionChar string `json:"division_char" yaml:"division_char"` // 文件名分隔符
|
||||
LogLevel int `json:"log_level" yaml:"log_level"` // 日志等级
|
||||
@ -60,14 +59,15 @@ func GetLogInstanceFromInputConfig(logConf *InputLogConfig) (*zap.Logger, error)
|
||||
var (
|
||||
err error
|
||||
loggerInstance *zap.Logger
|
||||
splitConfig *RotateLogConfig
|
||||
)
|
||||
splitConfig := &RotateLogConfig{
|
||||
TimeIntervalType: logConf.TimeIntervalType,
|
||||
LogPath: logConf.Path,
|
||||
LogFileName: logConf.Name,
|
||||
DivisionChar: logConf.DivisionChar,
|
||||
FullLogFormat: logConf.Format,
|
||||
MaxAge: time.Duration(logConf.MaxAge) * time.Second,
|
||||
if splitConfig, err = NewRotateLogConfig(
|
||||
logConf.Path,
|
||||
logConf.Name,
|
||||
WithDivisionChar(logConf.DivisionChar),
|
||||
WithTimeIntervalType(logConf.TimeIntervalType),
|
||||
WithMaxAge(time.Duration(logConf.MaxAge)*time.Second)); nil != err {
|
||||
return nil, err
|
||||
}
|
||||
if loggerInstance, err = NewLogger(zapcore.Level(logConf.LogLevel), splitConfig, logConfList...); nil != err {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user