appendAttribute appends a single attribute to the buffer.
(attr slog.Attr)
| 136 | |
| 137 | // appendAttribute appends a single attribute to the buffer. |
| 138 | func (s *formatterPretty) appendAttribute(attr slog.Attr) { |
| 139 | // Resolve [slog.LogValuer] values |
| 140 | attr.Value = attr.Value.Resolve() |
| 141 | |
| 142 | // If there are no groups opened, save special attributes for later |
| 143 | if s.groupsOpened == 0 && s.saveSpecialAttr(attr) { |
| 144 | return |
| 145 | } |
| 146 | |
| 147 | // Groups need special handling |
| 148 | if attr.Value.Kind() == slog.KindGroup { |
| 149 | s.appendGroup(attr.Key, attr.Value.Group()) |
| 150 | return |
| 151 | } |
| 152 | |
| 153 | s.appendKey(attr.Key) |
| 154 | s.appendValue(attr.Value) |
| 155 | } |
| 156 | |
| 157 | // appendKey appends an attribute key to the buffer. |
| 158 | func (s *formatterPretty) appendKey(key string) { |
no test coverage detected