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

Function ExampleEvent_Dict

binary_test.go:205–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203}
204
205func ExampleEvent_Dict() {
206 dst := bytes.Buffer{}
207 log := New(&dst)
208
209 e := log.Log().
210 Str("foo", "bar")
211
212 e.Dict("dict", e.CreateDict().
213 Str("bar", "baz").
214 Int("n", 1),
215 ).
216 Msg("hello world")
217
218 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
219 // Output: {"foo":"bar","dict":{"bar":"baz","n":1},"message":"hello world"}
220}
221
222type User struct {
223 Name string

Callers

nothing calls this directly

Calls 10

NewFunction · 0.85
MsgMethod · 0.80
PrintlnMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
LogMethod · 0.65
StrMethod · 0.45
DictMethod · 0.45
IntMethod · 0.45
CreateDictMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…