Merged in fix-verbosity-flag (pull request #144)

cmd/revid-cli: initialisation of logger actually usses what was given as revid-cli verbosity flag input
This commit is contained in:
Saxon Milton 2019-02-28 03:03:13 +00:00
commit 4cfb85b8e1
1 changed files with 18 additions and 12 deletions

View File

@ -145,7 +145,24 @@ func handleFlags() revid.Config {
flag.Parse() 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 cfg.Logger = log
@ -229,17 +246,6 @@ func handleFlags() revid.Config {
log.Log(logger.Error, pkg+"bad packetization argument") 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 != "" { if *configFilePtr != "" {
netsender.ConfigFile = *configFilePtr netsender.ConfigFile = *configFilePtr
} }