()
| 546 | } |
| 547 | |
| 548 | func ExampleContext_Durs() { |
| 549 | d := []time.Duration{ |
| 550 | time.Duration(10 * time.Second), |
| 551 | time.Duration(20 * time.Second), |
| 552 | } |
| 553 | |
| 554 | dst := bytes.Buffer{} |
| 555 | log := New(&dst).With(). |
| 556 | Str("foo", "bar"). |
| 557 | Durs("durs", d). |
| 558 | Logger() |
| 559 | |
| 560 | log.Log().Msg("hello world") |
| 561 | |
| 562 | fmt.Println(decodeIfBinaryToString(dst.Bytes())) |
| 563 | // Output: {"foo":"bar","durs":[10000,20000],"message":"hello world"} |
| 564 | } |
| 565 | |
| 566 | func ExampleContext_Fields_map() { |
| 567 | fields := map[string]interface{}{ |