feat:完善项目

This commit is contained in:
henry
2021-11-08 15:52:46 +08:00
parent 1502076841
commit 1cc95fb5ca
16 changed files with 154 additions and 64 deletions

View File

@ -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
}