NewNop returns a no-op Logger. It never writes out logs or internal errors, and it never runs user-defined hooks. Using WithOptions to replace the Core or error output of a no-op Logger can re-enable logging.
()
| 85 | // Using WithOptions to replace the Core or error output of a no-op Logger can |
| 86 | // re-enable logging. |
| 87 | func NewNop() *Logger { |
| 88 | return &Logger{ |
| 89 | core: zapcore.NewNopCore(), |
| 90 | errorOutput: zapcore.AddSync(io.Discard), |
| 91 | addStack: zapcore.FatalLevel + 1, |
| 92 | clock: zapcore.DefaultClock, |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | // NewProduction builds a sensible production Logger that writes InfoLevel and |
| 97 | // above logs to standard error as JSON. |