MCPcopy
hub / github.com/uber-go/zap / Stringers

Function Stringers

array.go:216–218  ·  view source on GitHub ↗

Stringers constructs a field with the given key, holding a list of the output provided by the value's String method Given an object that implements String on the value receiver, you can log a slice of those objects with Objects like so: type Request struct{ ... } func (a Request) String() string

(key string, values []T)

Source from the content-addressed store, hash-verified

214// That is, if you're trying to marshal a []Request, the String method
215// must be declared on the Request type, not its pointer (*Request).
216func Stringers[T fmt.Stringer](key string, values []T) Field {
217 return Array(key, stringers[T](values))
218}
219
220type stringers[T fmt.Stringer] []T
221

Callers 1

TestStringersFunction · 0.85

Calls 1

ArrayFunction · 0.85

Tested by 1

TestStringersFunction · 0.68