()
| 434 | } |
| 435 | |
| 436 | func ExampleObjectValues() { |
| 437 | logger := zap.NewExample() |
| 438 | defer logger.Sync() |
| 439 | |
| 440 | // Use the ObjectValues field constructor when you have a list of |
| 441 | // objects that do not implement zapcore.ObjectMarshaler directly, |
| 442 | // but on their pointer receivers. |
| 443 | logger.Debug("starting tunnels", |
| 444 | zap.ObjectValues("addrs", []request{ |
| 445 | { |
| 446 | URL: "/foo", |
| 447 | Listen: addr{"127.0.0.1", 8080}, |
| 448 | Remote: addr{"123.45.67.89", 4040}, |
| 449 | }, |
| 450 | { |
| 451 | URL: "/bar", |
| 452 | Listen: addr{"127.0.0.1", 8080}, |
| 453 | Remote: addr{"127.0.0.1", 31200}, |
| 454 | }, |
| 455 | })) |
| 456 | // Output: |
| 457 | // {"level":"debug","msg":"starting tunnels","addrs":[{"url":"/foo","ip":"127.0.0.1","port":8080,"remote":{"ip":"123.45.67.89","port":4040}},{"url":"/bar","ip":"127.0.0.1","port":8080,"remote":{"ip":"127.0.0.1","port":31200}}]} |
| 458 | } |
nothing calls this directly
no test coverage detected