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

Function Objects

array.go:130–132  ·  view source on GitHub ↗

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

(key string, values []T)

Source from the content-addressed store, hash-verified

128// var requests []Request = ...
129// logger.Info("sending requests", zap.ObjectValues("requests", requests))
130func Objects[T zapcore.ObjectMarshaler](key string, values []T) Field {
131 return Array(key, objects[T](values))
132}
133
134type objects[T zapcore.ObjectMarshaler] []T
135

Callers 5

ExampleObjectsFunction · 0.92
ExampleDictObjectFunction · 0.92
TestDictObjectFunction · 0.85

Calls 1

ArrayFunction · 0.85

Tested by 5

ExampleObjectsFunction · 0.74
ExampleDictObjectFunction · 0.74
TestDictObjectFunction · 0.68