Hooks registers functions which will be called each time the Logger writes out an Entry. Repeated use of Hooks is additive. Hooks are useful for simple side effects, like capturing metrics for the number of emitted logs. More complex side effects, including anything that requires access to the Entr
(hooks ...func(zapcore.Entry) error)
| 53 | // requires access to the Entry's structured fields, should be implemented as |
| 54 | // a zapcore.Core instead. See zapcore.RegisterHooks for details. |
| 55 | func Hooks(hooks ...func(zapcore.Entry) error) Option { |
| 56 | return optionFunc(func(log *Logger) { |
| 57 | log.core = zapcore.RegisterHooks(log.core, hooks...) |
| 58 | }) |
| 59 | } |
| 60 | |
| 61 | // Fields adds fields to the Logger. |
| 62 | func Fields(fs ...Field) Option { |