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

Method appendAttribute

logger/formatter_structured.go:84–101  ·  view source on GitHub ↗

appendAttribute appends a single attribute to the buffer.

(attr slog.Attr)

Source from the content-addressed store, hash-verified

82
83// appendAttribute appends a single attribute to the buffer.
84func (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.
104func (s *formatterStructured) appendKey(key string) {

Callers 2

formatMethod · 0.95
appendAttributesMethod · 0.95

Calls 5

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

Tested by

no test coverage detected