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

Function ExampleEvent_Dict

log_example_test.go:192–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190}
191
192func ExampleEvent_Dict() {
193 log := zerolog.New(os.Stdout)
194
195 e := log.Log().
196 Str("foo", "bar")
197
198 e.Dict("dict", e.CreateDict().
199 Str("bar", "baz").
200 Int("n", 1),
201 ).
202 Msg("hello world")
203
204 // Output: {"foo":"bar","dict":{"bar":"baz","n":1},"message":"hello world"}
205}
206
207type User struct {
208 Name string

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
MsgMethod · 0.80
LogMethod · 0.65
StrMethod · 0.45
DictMethod · 0.45
IntMethod · 0.45
CreateDictMethod · 0.45

Tested by

no test coverage detected