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