From 3e72919170e4b56e9e31132b98561b9c5c2d13ff Mon Sep 17 00:00:00 2001 From: Ryan Smith Date: Mon, 3 Mar 2025 22:26:41 -0800 Subject: [PATCH] Use slog.DiscardHandler when logging is disabled This change switches to using slog.DiscardHandler, added to Go 1.24, when logging is disabled. --- internal/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/config/config.go b/internal/config/config.go index 305e6a1..592b172 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -211,7 +211,7 @@ func (c *Config) InitializeLoggers() error { // If no log path is specified or if logging is disabled, discard logs. if len(logPath) == 0 || !c.Servers[i].LogEnabled { - c.Servers[i].Logger = slog.New(slog.NewTextHandler(io.Discard, nil)) + c.Servers[i].Logger = slog.New(slog.DiscardHandler) continue }