| 258 | } |
| 259 | |
| 260 | func ExampleEvent_Array_object() { |
| 261 | dst := bytes.Buffer{} |
| 262 | log := New(&dst) |
| 263 | |
| 264 | // Users implements LogArrayMarshaler |
| 265 | u := Users{ |
| 266 | User{"John", 35, time.Time{}}, |
| 267 | User{"Bob", 55, time.Time{}}, |
| 268 | } |
| 269 | |
| 270 | log.Log(). |
| 271 | Str("foo", "bar"). |
| 272 | Array("users", u). |
| 273 | Msg("hello world") |
| 274 | |
| 275 | fmt.Println(decodeIfBinaryToString(dst.Bytes())) |
| 276 | // 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"} |
| 277 | } |
| 278 | |
| 279 | func ExampleEvent_Object() { |
| 280 | dst := bytes.Buffer{} |