MCPcopy
hub / github.com/rs/zerolog / Object

Method Object

event.go:252–265  ·  view source on GitHub ↗

Object marshals an object that implement the LogObjectMarshaler interface.

(key string, obj LogObjectMarshaler)

Source from the content-addressed store, hash-verified

250
251// Object marshals an object that implement the LogObjectMarshaler interface.
252func (e *Event) Object(key string, obj LogObjectMarshaler) *Event {
253 if e == nil {
254 return e
255 }
256 e.buf = enc.AppendKey(e.buf, key)
257 if obj == nil {
258 e.buf = enc.AppendNil(e.buf)
259
260 return e
261 }
262
263 e.appendObject(obj)
264 return e
265}
266
267// Objects adds the field key with objs as an array of objects that
268// implement the LogObjectMarshaler interface to the event.

Callers 15

AnErrMethod · 0.95
ErrMethod · 0.95
InterfaceMethod · 0.95
TestEvent_WithNilEventFunction · 0.95
MarshalZerologArrayMethod · 0.45
ExampleEvent_ObjectFunction · 0.45
ExampleContext_ObjectFunction · 0.45
TestFieldsFunction · 0.45
TestArrayFunction · 0.45
MarshalZerologArrayMethod · 0.45
ExampleEvent_ObjectFunction · 0.45
ExampleContext_ObjectFunction · 0.45

Calls 3

appendObjectMethod · 0.95
AppendKeyMethod · 0.65
AppendNilMethod · 0.65

Tested by 13

TestEvent_WithNilEventFunction · 0.76
MarshalZerologArrayMethod · 0.36
ExampleEvent_ObjectFunction · 0.36
ExampleContext_ObjectFunction · 0.36
TestFieldsFunction · 0.36
TestArrayFunction · 0.36
MarshalZerologArrayMethod · 0.36
ExampleEvent_ObjectFunction · 0.36
ExampleContext_ObjectFunction · 0.36
TestEvent_ObjectFunction · 0.36
BenchmarkLogArrayObjectFunction · 0.36
BenchmarkLogFieldTypeFunction · 0.36