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

Function ExampleContext_Interface

binary_test.go:514–531  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

512}
513
514func ExampleContext_Interface() {
515 obj := struct {
516 Name string `json:"name"`
517 }{
518 Name: "john",
519 }
520
521 dst := bytes.Buffer{}
522 log := New(&dst).With().
523 Str("foo", "bar").
524 Interface("obj", obj).
525 Logger()
526
527 log.Log().Msg("hello world")
528
529 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
530 // Output: {"foo":"bar","obj":{"name":"john"},"message":"hello world"}
531}
532
533func ExampleContext_Dur() {
534 d := time.Duration(10 * time.Second)

Callers

nothing calls this directly

Calls 10

NewFunction · 0.85
LoggerMethod · 0.80
WithMethod · 0.80
MsgMethod · 0.80
PrintlnMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
LogMethod · 0.65
InterfaceMethod · 0.45
StrMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…