diff --git a/bootstrap/log.go b/bootstrap/log.go index 08a79e8f..c64e7353 100644 --- a/bootstrap/log.go +++ b/bootstrap/log.go @@ -22,7 +22,7 @@ func Log() { FullTimestamp: true, }) logConfig := conf.Conf.Log - if !args.Debug && logConfig.Path != "" { + if logConfig.Enable { var ( writer *rotatelogs.RotateLogs err error diff --git a/conf/config.go b/conf/config.go index 01fabe96..cd276c31 100644 --- a/conf/config.go +++ b/conf/config.go @@ -24,6 +24,7 @@ type CacheConfig struct { } type LogConfig struct { + Enable bool `json:"enable" env:"log_enable"` Path string `json:"path" env:"LOG_PATH"` Name string `json:"name" env:"LOG_NAME"` RotationTime uint `json:"rotation_time" env:"LOG_TIME"` @@ -59,6 +60,7 @@ func DefaultConfig() *Config { CleanupInterval: 120, }, Log: LogConfig{ + Enable: true, Path: "log/%Y-%m-%d-%H:%M.log", Name: "log/log.log", RotationTime: 24,