From c3743174da97ecf6b2bea074a76a1137d4983145 Mon Sep 17 00:00:00 2001 From: saxon Date: Tue, 12 Feb 2019 18:37:15 +1030 Subject: [PATCH] cmd/revid-cli: initialisation of logger actually usses what was given as revid-cli verbosity flag input --- cmd/revid-cli/main.go | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/cmd/revid-cli/main.go b/cmd/revid-cli/main.go index 6ca6ba68..a53d08a0 100644 --- a/cmd/revid-cli/main.go +++ b/cmd/revid-cli/main.go @@ -145,7 +145,24 @@ func handleFlags() revid.Config { flag.Parse() - log = logger.New(defaultLogVerbosity, &smartlogger.New(*logPathPtr).LogRoller) + switch *verbosityPtr { + case "Debug": + cfg.LogLevel = logger.Debug + case "Info": + cfg.LogLevel = logger.Info + case "Warning": + cfg.LogLevel = logger.Warning + case "Error": + cfg.LogLevel = logger.Error + case "Fatal": + cfg.LogLevel = logger.Fatal + case "": + cfg.LogLevel = defaultLogVerbosity + default: + log.Log(logger.Error, pkg+"bad verbosity argument") + } + + log = logger.New(cfg.LogLevel, &smartlogger.New(*logPathPtr).LogRoller) cfg.Logger = log @@ -225,17 +242,6 @@ func handleFlags() revid.Config { log.Log(logger.Error, pkg+"bad packetization argument") } - switch *verbosityPtr { - case "No": - cfg.LogLevel = logger.Fatal - case "Debug": - cfg.LogLevel = logger.Debug - //logger.SetLevel(logger.Debug) - case "": - default: - log.Log(logger.Error, pkg+"bad verbosity argument") - } - if *configFilePtr != "" { netsender.ConfigFile = *configFilePtr }