Skip to content

Commit

Permalink
Fixed typo, print msg and exit on invalid --loglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
supertypo committed Jul 14, 2023
1 parent 0aa2d49 commit bd49ce3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ var (
)

func initLog(noLogFiles bool, logLevel, logFile, errLogFile string) {
level, _ := logger.LevelFromString(logLevel)
level, ok := logger.LevelFromString(logLevel)
if !ok {
fmt.Fprintf(os.Stderr, "Invalid loglevel: %s", logLevel)
os.Exit(1)
}
err := backendLog.AddLogWriter(os.Stdout, level)
if err != nil {
fmt.Fprintf(os.Stderr, "Error adding stdout to the loggerfor level %s: %s", logger.LevelWarn, err)
fmt.Fprintf(os.Stderr, "Error adding stdout to the logger for level %s: %s", logger.LevelWarn, err)
os.Exit(1)
}

Expand Down

0 comments on commit bd49ce3

Please sign in to comment.