Skip to content

Commit

Permalink
log: avoid setting default slog logger in init (ethereum#28747)
Browse files Browse the repository at this point in the history
slog.SetDefault has undesirable side effects. It also sets the default logger destination,
for example. So we should not call it by default in init.
  • Loading branch information
gzliudan committed Nov 15, 2024
1 parent 5aac236 commit f5a328a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions log/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
var root atomic.Value

func init() {
defaultLogger := &logger{slog.New(DiscardHandler())}
SetDefault(defaultLogger)
root.Store(&logger{slog.New(DiscardHandler())})
}

// SetDefault sets the default global logger
Expand Down

0 comments on commit f5a328a

Please sign in to comment.