feat:完善项目
This commit is contained in:
@ -42,18 +42,18 @@ func (this *Logger) Load() {
|
||||
func (this *Logger) Init(option *Option) *Logger {
|
||||
this.Option = option
|
||||
|
||||
logger = log.New()
|
||||
logger.SetFormatter(&log.JSONFormatter{TimestampFormat: "2006-01-02 15:04:05"})
|
||||
logger.SetReportCaller(true)
|
||||
logger.AddHook(NewHook(this.File, 0, this.LeastDay))
|
||||
_logger := log.New()
|
||||
_logger.SetFormatter(&log.JSONFormatter{TimestampFormat: "2006-01-02 15:04:05"})
|
||||
_logger.SetReportCaller(true)
|
||||
_logger.AddHook(NewHook(this.File, 0, this.LeastDay))
|
||||
|
||||
if this.IsStdout {
|
||||
logger.SetOutput(io.MultiWriter(os.Stdout))
|
||||
_logger.SetOutput(io.MultiWriter(os.Stdout))
|
||||
}
|
||||
logger.SetFormatter(formatter(true))
|
||||
logger.SetLevel(this.level())
|
||||
_logger.SetFormatter(formatter(true))
|
||||
_logger.SetLevel(this.level())
|
||||
|
||||
this.Logger = logger
|
||||
this.Logger = _logger
|
||||
|
||||
return this
|
||||
}
|
||||
|
Reference in New Issue
Block a user