Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
imranismail committed Apr 13, 2022
1 parent 7ce1bd1 commit 6a1e0dd
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ func (logger *Logger) Errorf(format string, args ...interface{}) {
}

func NewLogger() Logger {
level, err := zerolog.ParseLevel(viper.GetString("verbosity"))

if err != nil {
log.Fatal().Msgf("Failed to parse verbosity: %v", err)
}

zerolog.SetGlobalLevel(level)

return Logger{}
}

Expand All @@ -107,13 +115,6 @@ func initConfig() {

err := viper.ReadInConfig()
logger := NewLogger()
level, err := zerolog.ParseLevel(viper.GetString("verbosity"))

if err != nil {
log.Fatal().Msgf("Failed to parse verbosity: %v", err)
}

zerolog.SetGlobalLevel(level)
mlog.SetLogger(&logger)

// If a config file is found, read it in
Expand Down

0 comments on commit 6a1e0dd

Please sign in to comment.