Skip to content

Commit

Permalink
mod default log level
Browse files Browse the repository at this point in the history
  • Loading branch information
sheyanjie-qq committed Sep 9, 2024
1 parent 75c4e98 commit 456ba72
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions infrastructure/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,21 @@ ReadConfig:
conf.Cors.Init()
pool.Init(conf.GoPoolSize)
conf.Log.SetValue()

// set log level default value: info
if conf.LogLevel == "" {
conf.LogLevel = "info"
}
if viper.IsSet("log.level") {
conf.LogLevel = conf.Log.Level
} else {
viper.Set("log.level", "")
}

if !viper.IsSet("logLevel") {
viper.Set("logLevel", "")
}

Conf = &conf
return &conf
}
Expand All @@ -149,7 +161,6 @@ func init() {
_ = viper.BindEnv("port", "TAOS_KEEPER_PORT")
pflag.IntP("port", "P", 6043, `http port. Env "TAOS_KEEPER_PORT"`)

viper.SetDefault("logLevel", "info")
_ = viper.BindEnv("logLevel", "TAOS_KEEPER_LOG_LEVEL")
pflag.String("logLevel", "info", `log level (trace debug info warning error). Env "TAOS_KEEPER_LOG_LEVEL"`)

Expand Down Expand Up @@ -228,7 +239,6 @@ func initLog() {
pflag.String("log.path", fmt.Sprintf("/var/log/%s", version.CUS_PROMPT), `log path. Env "TAOS_KEEPER_LOG_PATH"`)
}

viper.SetDefault("log.level", "info")
_ = viper.BindEnv("log.level", "TAOS_KEEPER_LOG_LEVEL")
pflag.String("log.level", "info", `log level (trace debug info warning error). Env "TAOS_KEEPER_LOG_LEVEL"`)

Expand Down

0 comments on commit 456ba72

Please sign in to comment.