From cbd979adcdaec74c8c73628a47f812d4d74919c2 Mon Sep 17 00:00:00 2001 From: Ekaterina Vinnik Date: Wed, 10 Jul 2024 16:29:58 +0300 Subject: [PATCH] Return receiver in WithGroups method when name is empty (#5) * Return receiver in WithGroups method when name is empty * Update handler.go --------- Co-authored-by: Samuel Berthe --- handler.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/handler.go b/handler.go index 821c4ab..de9893c 100644 --- a/handler.go +++ b/handler.go @@ -97,6 +97,11 @@ func (h *SyslogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { } func (h *SyslogHandler) WithGroup(name string) slog.Handler { + // https://cs.opensource.google/go/x/exp/+/46b07846:slog/handler.go;l=247 + if name == "" { + return h + } + return &SyslogHandler{ option: h.option, attrs: h.attrs,