()
| 10 | ) |
| 11 | |
| 12 | func ExampleWithField() { |
| 13 | ctx := context.Background() |
| 14 | ctx = WithField(ctx, "foo", "bar") |
| 15 | |
| 16 | log := New("testing") |
| 17 | |
| 18 | // Typically called as log(ctx, nil).Debug("the message") |
| 19 | entry := log(ctx, nil) |
| 20 | fmt.Printf("%+v", entry.Data["foo"]) |
| 21 | |
| 22 | // Output: |
| 23 | // bar |
| 24 | } |
| 25 | |
| 26 | func ExampleWithFields() { |
| 27 | ctx := context.Background() |