()
| 287 | } |
| 288 | |
| 289 | func ExampleLogger_Check() { |
| 290 | logger := zap.NewExample() |
| 291 | defer logger.Sync() |
| 292 | |
| 293 | if ce := logger.Check(zap.DebugLevel, "debugging"); ce != nil { |
| 294 | // If debug-level log output isn't enabled or if zap's sampling would have |
| 295 | // dropped this log entry, we don't allocate the slice that holds these |
| 296 | // fields. |
| 297 | ce.Write( |
| 298 | zap.String("foo", "bar"), |
| 299 | zap.String("baz", "quux"), |
| 300 | ) |
| 301 | } |
| 302 | |
| 303 | // Output: |
| 304 | // {"level":"debug","msg":"debugging","foo":"bar","baz":"quux"} |
| 305 | } |
| 306 | |
| 307 | func ExampleLogger_Named() { |
| 308 | logger := zap.NewExample() |
nothing calls this directly
no test coverage detected