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

Method Dict

event.go:182–189  ·  view source on GitHub ↗

Dict adds the field key with a dict to the event context. Use e.CreateDict() to create the dictionary.

(key string, dict *Event)

Source from the content-addressed store, hash-verified

180// Dict adds the field key with a dict to the event context.
181// Use e.CreateDict() to create the dictionary.
182func (e *Event) Dict(key string, dict *Event) *Event {
183 if e != nil {
184 dict.buf = enc.AppendEndMarker(dict.buf)
185 e.buf = append(enc.AppendKey(e.buf, key), dict.buf...)
186 }
187 putEvent(dict)
188 return e
189}
190
191// CreateDict creates an Event to be used with the *Event.Dict method.
192// It preserves the stack, hooks, and context from the parent event.

Callers 7

TestEvent_WithNilEventFunction · 0.95
ExampleEvent_DictFunction · 0.45
ExampleEvent_ArrayFunction · 0.45
ExampleContext_DictFunction · 0.45
TestArrayFunction · 0.45
ExampleEvent_DictFunction · 0.45
ExampleContext_DictFunction · 0.45

Calls 3

putEventFunction · 0.85
AppendEndMarkerMethod · 0.65
AppendKeyMethod · 0.65

Tested by 7

TestEvent_WithNilEventFunction · 0.76
ExampleEvent_DictFunction · 0.36
ExampleEvent_ArrayFunction · 0.36
ExampleContext_DictFunction · 0.36
TestArrayFunction · 0.36
ExampleEvent_DictFunction · 0.36
ExampleContext_DictFunction · 0.36