Skip to content

Commit 170cd3c

Browse files
enable debug logging if enabled in config file (#215)
1 parent 9851753 commit 170cd3c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func main() {
128128
viper.AutomaticEnv()
129129
viper.SetEnvPrefix("ts")
130130

131-
// Commandline over-rides config file for debugging
131+
// Enable debug mode if specified by commandline argument, regardless of what is in config file
132132
if *flagDebugOn {
133133
viper.Set("Debug", true)
134134
log.SetLevel(log.TraceLevel)
@@ -182,6 +182,11 @@ func main() {
182182
}
183183
}
184184

185+
// enable debug mode if specified in config file, even if not specified by commandline argument
186+
if viper.GetBool("Debug") == true {
187+
log.SetLevel(log.TraceLevel)
188+
}
189+
185190
basePath := viper.GetString("BasePath")
186191
log.Infof("Serving HTTP at %s/", formatBaseURL(fmt.Sprintf("http://%s:%d",
187192
viper.GetString("HttpHost"), viper.GetInt("HttpPort")), basePath))

0 commit comments

Comments
 (0)