Skip to content

Commit 5c323fe

Browse files
- reinitialize the logger in case the log-level config is changed by a config file. (#406)
1 parent 06d6b0d commit 5c323fe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/param_parsing/parameters.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func GetParameters() Params {
5050
// Parse the command line parameters to fetch stuff like chdir
5151
getopt.Parse()
5252

53+
oldLogLevel := params.LogLevel
5354
logger = lib.InitLogger(params.LogLevel)
5455
var err error
5556
// Read configuration files
@@ -70,6 +71,11 @@ func GetParameters() Params {
7071
logger.Fatalf("Error parsing configuration file: %q", err)
7172
}
7273

74+
// Logger config was changed by the config files. Reinitialise.
75+
if params.LogLevel != oldLogLevel {
76+
logger = lib.InitLogger(params.LogLevel)
77+
}
78+
7379
// Parse again to overwrite anything that might by defined on the cli AND in any config file (CLI always wins)
7480
getopt.Parse()
7581
args := getopt.Args()

0 commit comments

Comments
 (0)