()
| 512 | } |
| 513 | |
| 514 | func 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 | |
| 533 | func ExampleContext_Dur() { |
| 534 | d := time.Duration(10 * time.Second) |
nothing calls this directly
no test coverage detected
searching dependent graphs…