CheckWriteHook is a custom action that may be executed after an entry is written. Register one on a CheckedEntry with the After method. if ce := logger.Check(...); ce != nil { ce = ce.After(hook) ce.Write(...) } You can configure the hook for Fatal log statements at the logger level with
| 162 | // You can configure the hook for Fatal log statements at the logger level with |
| 163 | // the zap.WithFatalHook option. |
| 164 | type CheckWriteHook interface { |
| 165 | // OnWrite is invoked with the CheckedEntry that was written and a list |
| 166 | // of fields added with that entry. |
| 167 | // |
| 168 | // The list of fields DOES NOT include fields that were already added |
| 169 | // to the logger with the With method. |
| 170 | OnWrite(*CheckedEntry, []Field) |
| 171 | } |
| 172 | |
| 173 | // CheckWriteAction indicates what action to take after a log entry is |
| 174 | // processed. Actions are ordered in increasing severity. |