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

Function ExampleEvent_Array

binary_test.go:243–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241}
242
243func ExampleEvent_Array() {
244 dst := bytes.Buffer{}
245 log := New(&dst)
246
247 e := log.Log().
248 Str("foo", "bar")
249
250 e.Array("array", e.CreateArray().
251 Str("baz").
252 Int(1),
253 ).
254 Msg("hello world")
255
256 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
257 // Output: {"foo":"bar","array":["baz",1],"message":"hello world"}
258}
259
260func ExampleEvent_Array_object() {
261 dst := bytes.Buffer{}

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
ArrayMethod · 0.45
IntMethod · 0.45
CreateArrayMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected