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

Function ExampleEvent_Interface

log_example_test.go:334–349  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

332}
333
334func ExampleEvent_Interface() {
335 log := zerolog.New(os.Stdout)
336
337 obj := struct {
338 Name string `json:"name"`
339 }{
340 Name: "john",
341 }
342
343 log.Log().
344 Str("foo", "bar").
345 Interface("obj", obj).
346 Msg("hello world")
347
348 // Output: {"foo":"bar","obj":{"name":"john"},"message":"hello world"}
349}
350
351func ExampleEvent_Dur() {
352 d := 10 * time.Second

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
MsgMethod · 0.80
LogMethod · 0.65
InterfaceMethod · 0.45
StrMethod · 0.45

Tested by

no test coverage detected