From 2dc2a70a27bc4e8c24534e885489e8153f579268 Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Wed, 10 Jul 2024 15:35:41 +0200 Subject: [PATCH] feat: when the name is empty, WithGroup returns the receiver --- handler.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/handler.go b/handler.go index e637bb0..0a77a76 100644 --- a/handler.go +++ b/handler.go @@ -81,6 +81,11 @@ func (h *LokiHandler) WithAttrs(attrs []slog.Attr) slog.Handler { } func (h *LokiHandler) WithGroup(name string) slog.Handler { + // https://cs.opensource.google/go/x/exp/+/46b07846:slog/handler.go;l=247 + if name == "" { + return h + } + return &LokiHandler{ option: h.option, attrs: h.attrs,