Skip to content

Commit

Permalink
fix(cli): always output fatal errors to stderr (#6827)
Browse files Browse the repository at this point in the history
Signed-off-by: knqyf263 <[email protected]>
  • Loading branch information
knqyf263 authored Jun 2, 2024
1 parent aa0c413 commit c2b9132
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ func Errorf(format string, args ...any) { slog.Default().Error(fmt.Sprintf(forma

// Fatal for logging fatal errors
func Fatal(msg string, args ...any) {
slog.Default().Log(context.Background(), LevelFatal, msg, args...)
// Fatal errors should be logged to stderr even if the logger is disabled.
New(NewHandler(os.Stderr, &Options{})).Log(context.Background(), LevelFatal, msg, args...)
os.Exit(1)
}

Expand Down

0 comments on commit c2b9132

Please sign in to comment.