Skip to content

Commit

Permalink
fix: Address PR review feedback
Browse files Browse the repository at this point in the history
* Make verbosity specification into an `else if`
* Remove the poorly implemented lock around SetLogLevel()
  • Loading branch information
tarkatronic committed Jul 3, 2023
1 parent 8a14248 commit ed216bd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 1 addition & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ Vulnbot empowers developers and security teams to efficiently manage and respond

if quiet == true {
logger.SetLogLevel(zerolog.Disabled)
}
if verbosity > 0 {
} else if verbosity > 0 {
if verbosity > 3 {
verbosity = 3
}
Expand Down
3 changes: 0 additions & 3 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

const DEFAULT_LOG_LEVEL = zerolog.WarnLevel

var lock = sync.Mutex{}
var log zerolog.Logger
var once sync.Once

Expand All @@ -38,10 +37,8 @@ func Get() zerolog.Logger {
}

func SetLogLevel(logLevel zerolog.Level) zerolog.Logger {
lock.Lock()
log := Get()
zerolog.SetGlobalLevel(logLevel)
log = log.Level(logLevel)
lock.Unlock()
return log
}

0 comments on commit ed216bd

Please sign in to comment.