()
| 327 | } |
| 328 | |
| 329 | func ExampleEvent_Interface() { |
| 330 | dst := bytes.Buffer{} |
| 331 | log := New(&dst) |
| 332 | |
| 333 | obj := struct { |
| 334 | Name string `json:"name"` |
| 335 | }{ |
| 336 | Name: "john", |
| 337 | } |
| 338 | |
| 339 | log.Log(). |
| 340 | Str("foo", "bar"). |
| 341 | Interface("obj", obj). |
| 342 | Msg("hello world") |
| 343 | |
| 344 | fmt.Println(decodeIfBinaryToString(dst.Bytes())) |
| 345 | // Output: {"foo":"bar","obj":{"name":"john"},"message":"hello world"} |
| 346 | } |
| 347 | |
| 348 | func ExampleEvent_Dur() { |
| 349 | d := time.Duration(10 * time.Second) |