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

Method appendAttribute

logger/formatter_json.go:114–131  ·  view source on GitHub ↗

appendAttribute appends a single attribute to the buffer.

(attr slog.Attr)

Source from the content-addressed store, hash-verified

112
113// appendAttribute appends a single attribute to the buffer.
114func (s *formatterJSON) appendAttribute(attr slog.Attr) {
115 // Resolve [slog.LogValuer] values
116 attr.Value = attr.Value.Resolve()
117
118 // If there are no groups opened, save special attributes for later
119 if s.groupsOpened == 0 && s.saveSpecialAttr(attr) {
120 return
121 }
122
123 // Groups need special handling
124 if attr.Value.Kind() == slog.KindGroup {
125 s.appendGroup(attr.Key, attr.Value.Group())
126 return
127 }
128
129 s.appendKey(attr.Key)
130 s.appendValue(attr.Value)
131}
132
133// appendKey appends an attribute key to the buffer.
134func (s *formatterJSON) 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