cmd/revid-cli: initialisation of logger actually usses what was given as revid-cli verbosity flag input

This commit is contained in:
saxon 2019-02-12 18:37:15 +10:30
parent dfb282cd25
commit c3743174da
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
@ -225,17 +242,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
} }