Skip to content

Commit

Permalink
Merge pull request #245 from thockin/sloghandler_empty_groups
Browse files Browse the repository at this point in the history
sloghandler: unnamed groups should be inlined
  • Loading branch information
pohly committed Dec 8, 2023
2 parents 006d752 + b01bad7 commit c589653
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sloghandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ func (l *slogHandler) WithGroup(name string) slog.Handler {
if l.sink == nil {
return l
}
if name == "" {
// slog says to inline empty groups
return l
}
copy := *l
if l.slogSink != nil {
copy.slogSink = l.slogSink.WithGroup(name)
Expand Down

0 comments on commit c589653

Please sign in to comment.