From c053eb71b66d7bb0cd414b692f35fec94d7508f6 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 30 Dec 2023 21:16:02 +0100 Subject: [PATCH] log: avoid setting default slog logger in init (#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. --- log/root.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/log/root.go b/log/root.go index 71040fff47..8662d87063 100644 --- a/log/root.go +++ b/log/root.go @@ -10,8 +10,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