appendGroup appends a group of attributes to the buffer.
(name string, attrs []slog.Attr)
| 117 | |
| 118 | // appendGroup appends a group of attributes to the buffer. |
| 119 | func (s *formatterStructured) appendGroup(name string, attrs []slog.Attr) { |
| 120 | if len(attrs) == 0 { |
| 121 | return |
| 122 | } |
| 123 | |
| 124 | if len(name) > 0 { |
| 125 | // If the group has a name, open it and defer closing it. |
| 126 | // Unnamed groups should be treated as sets of regular attributes. |
| 127 | s.openGroup(name) |
| 128 | defer s.closeGroup(name) |
| 129 | } |
| 130 | |
| 131 | s.appendAttributes(attrs) |
| 132 | } |
| 133 | |
| 134 | // openGroup opens a new group of attributes. |
| 135 | func (s *formatterStructured) openGroup(name string) { |
no test coverage detected