Skip to content

Commit 8c78234

Browse files
committed
log: avoid setting default slog logger in init (ethereum#28747)
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.
1 parent 0d4644a commit 8c78234

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

log/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import (
1111
var root atomic.Value
1212

1313
func init() {
14-
defaultLogger := &logger{slog.New(DiscardHandler())}
15-
SetDefault(defaultLogger)
14+
root.Store(&logger{slog.New(DiscardHandler())})
1615
}
1716

1817
// SetDefault sets the default global logger

0 commit comments

Comments
 (0)