Add env variable "ODO_LOG_LEVEL" to control odo verbosity (#2351) (#2378)

* Add enviroment variable "ODO_LOG_LEVEL" to control odo verbosity. Command line flag "-v", if set, will take precedence over "ODO_LOG_LEVEL"
This commit is contained in:
Yusuf Kanchwala
2019-11-12 16:20:34 +05:30
committed by OpenShift Merge Robot
parent b5720763ac
commit 5eb0ff5e73
2 changed files with 10 additions and 1 deletions

View File

@@ -43,6 +43,13 @@ func main() {
}
}
// Override the logging level by the value (if set) by the ODO_LOG_LEVEL env
// The "-v" flag set on command line will take precedence over ODO_LOG_LEVEL env
v := flag.CommandLine.Lookup("v").Value.String()
if level, ok := os.LookupEnv("ODO_LOG_LEVEL"); ok && v == "0" {
_ = flag.CommandLine.Set("v", level)
}
// run the completion, in case that the completion was invoked
// and ran as a completion script or handled a flag that passed
// as argument, the Run method will return true,