Skip to content

Commit

Permalink
- reinitialize the logger in case the log-level config is changed by …
Browse files Browse the repository at this point in the history
…a config file. (#406)
  • Loading branch information
MatrixCrawler authored Apr 25, 2024
1 parent 06d6b0d commit 5c323fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/param_parsing/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func GetParameters() Params {
// Parse the command line parameters to fetch stuff like chdir
getopt.Parse()

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

// Logger config was changed by the config files. Reinitialise.
if params.LogLevel != oldLogLevel {
logger = lib.InitLogger(params.LogLevel)
}

// Parse again to overwrite anything that might by defined on the cli AND in any config file (CLI always wins)
getopt.Parse()
args := getopt.Args()
Expand Down

0 comments on commit 5c323fe

Please sign in to comment.