Skip to content

Commit

Permalink
go back to old verbosity conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
miampf committed Jan 31, 2024
1 parent 490fad6 commit ffc158b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/logger/cmdline.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import (
)

// CmdLineVerbosityDescription explains numeric log levels.
const CmdLineVerbosityDescription = "log verbosity in slog logging levels. Use -4 for debug information, 0 for info, 4 for warn, 8 for error"
const CmdLineVerbosityDescription = "log verbosity: Use -1 for debug information, 0 for info, 1 for warn, 2 for error"

// VerbosityFromInt converts a verbosity level from an integer to a slog.Level.
func VerbosityFromInt(verbosity int) slog.Level {
switch {
case verbosity <= -4:
case verbosity <= -1:
return slog.LevelDebug
case verbosity == 0:
return slog.LevelInfo
case verbosity == 4:
case verbosity == 1:
return slog.LevelWarn
case verbosity >= 8:
case verbosity >= 2:
return slog.LevelError
default:
return slog.LevelInfo
Expand Down

0 comments on commit ffc158b

Please sign in to comment.