Skip to content

Commit 5b73b68

Browse files
committed
feat: add log enable config
1 parent cd21f14 commit 5b73b68

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

bootstrap/log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func Log() {
2222
FullTimestamp: true,
2323
})
2424
logConfig := conf.Conf.Log
25-
if !args.Debug && logConfig.Path != "" {
25+
if logConfig.Enable {
2626
var (
2727
writer *rotatelogs.RotateLogs
2828
err error

conf/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type CacheConfig struct {
2424
}
2525

2626
type LogConfig struct {
27+
Enable bool `json:"enable" env:"log_enable"`
2728
Path string `json:"path" env:"LOG_PATH"`
2829
Name string `json:"name" env:"LOG_NAME"`
2930
RotationTime uint `json:"rotation_time" env:"LOG_TIME"`
@@ -59,6 +60,7 @@ func DefaultConfig() *Config {
5960
CleanupInterval: 120,
6061
},
6162
Log: LogConfig{
63+
Enable: true,
6264
Path: "log/%Y-%m-%d-%H:%M.log",
6365
Name: "log/log.log",
6466
RotationTime: 24,

0 commit comments

Comments
 (0)