| 438 | } |
| 439 | |
| 440 | func ExampleContext_Array_object() { |
| 441 | // Users implements zerolog.LogArrayMarshaler |
| 442 | u := Users{ |
| 443 | User{"John", 35, time.Time{}}, |
| 444 | User{"Bob", 55, time.Time{}}, |
| 445 | } |
| 446 | |
| 447 | log := zerolog.New(os.Stdout).With(). |
| 448 | Str("foo", "bar"). |
| 449 | Array("users", u). |
| 450 | Logger() |
| 451 | |
| 452 | log.Log().Msg("hello world") |
| 453 | |
| 454 | // Output: {"foo":"bar","users":[{"name":"John","age":35,"created":"0001-01-01T00:00:00Z"},{"name":"Bob","age":55,"created":"0001-01-01T00:00:00Z"}],"message":"hello world"} |
| 455 | } |
| 456 | |
| 457 | func ExampleContext_Object() { |
| 458 | // User implements zerolog.LogObjectMarshaler |