appendAttribute appends a single attribute to the buffer.
(attr slog.Attr)
| 82 | |
| 83 | // appendAttribute appends a single attribute to the buffer. |
| 84 | func (s *formatterStructured) appendAttribute(attr slog.Attr) { |
| 85 | // Resolve [slog.LogValuer] values |
| 86 | attr.Value = attr.Value.Resolve() |
| 87 | |
| 88 | // If there are no groups opened, save special attributes for later |
| 89 | if s.prefix.len() == 0 && s.saveSpecialAttr(attr) { |
| 90 | return |
| 91 | } |
| 92 | |
| 93 | // Groups need special handling |
| 94 | if attr.Value.Kind() == slog.KindGroup { |
| 95 | s.appendGroup(attr.Key, attr.Value.Group()) |
| 96 | return |
| 97 | } |
| 98 | |
| 99 | s.appendKey(attr.Key) |
| 100 | s.appendValue(attr.Value) |
| 101 | } |
| 102 | |
| 103 | // appendKey appends an attribute key to the buffer. |
| 104 | func (s *formatterStructured) appendKey(key string) { |
no test coverage detected