WithPanicHook sets a CheckWriteHook to run on Panic/DPanic logs. Zap will call this hook after writing a log statement with a Panic/DPanic level. For example, the following builds a logger that will exit the current goroutine after writing a Panic/DPanic log message, but it will not start a panic.
(hook zapcore.CheckWriteHook)
| 146 | // |
| 147 | // This is useful for testing Panic/DPanic log output. |
| 148 | func WithPanicHook(hook zapcore.CheckWriteHook) Option { |
| 149 | return optionFunc(func(log *Logger) { |
| 150 | log.onPanic = hook |
| 151 | }) |
| 152 | } |
| 153 | |
| 154 | // OnFatal sets the action to take on fatal logs. |
| 155 | // |