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

Function ObjectValues

array.go:174–176  ·  view source on GitHub ↗

ObjectValues constructs a field with the given key, holding a list of the provided objects, where pointers to these objects can be marshaled by Zap. Note that pointers to these objects must implement zapcore.ObjectMarshaler. That is, if you're trying to marshal a []Request, the MarshalLogObject met

(key string, values []T)

Source from the content-addressed store, hash-verified

172// var requests []*Request = ...
173// logger.Info("sending requests", zap.Objects("requests", requests))
174func ObjectValues[T any, P ObjectMarshalerPtr[T]](key string, values []T) Field {
175 return Array(key, objectValues[T, P](values))
176}
177
178type objectValues[T any, P ObjectMarshalerPtr[T]] []T
179

Callers 3

ExampleObjectValuesFunction · 0.92

Calls 1

ArrayFunction · 0.85

Tested by 3

ExampleObjectValuesFunction · 0.74