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

Method CreateDict

event.go:195–200  ·  view source on GitHub ↗

CreateDict creates an Event to be used with the *Event.Dict method. It preserves the stack, hooks, and context from the parent event. Call usual field methods like Str, Int etc to add fields to this event and give it as argument the *Event.Dict method.

()

Source from the content-addressed store, hash-verified

193// Call usual field methods like Str, Int etc to add fields to this
194// event and give it as argument the *Event.Dict method.
195func (e *Event) CreateDict() *Event {
196 if e == nil {
197 return newEvent(nil, DebugLevel, false, nil, nil)
198 }
199 return newEvent(nil, DebugLevel, e.stack, e.ctx, e.ch)
200}
201
202// Dict creates an Event to be used with the *Event.Dict method.
203// Call usual field methods like Str, Int etc to add fields to this

Callers 6

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

Calls 1

newEventFunction · 0.85

Tested by 6

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