MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / appendAttribute

Method appendAttribute

logger/formatter_pretty.go:138–155  ·  view source on GitHub ↗

appendAttribute appends a single attribute to the buffer.

(attr slog.Attr)

Source from the content-addressed store, hash-verified

136
137// appendAttribute appends a single attribute to the buffer.
138func (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.
158func (s *formatterPretty) appendKey(key string) {

Callers 2

formatMethod · 0.95
appendAttributesMethod · 0.95

Calls 4

appendGroupMethod · 0.95
appendKeyMethod · 0.95
appendValueMethod · 0.95
saveSpecialAttrMethod · 0.80

Tested by

no test coverage detected