SamplerHook registers a function which will be called when Sampler makes a decision. This hook may be used to get visibility into the performance of the sampler. For example, use it to track metrics of dropped versus sampled logs. var dropped atomic.Int64 zapcore.SamplerHook(func(ent zapcore.En
(hook func(entry Entry, dec SamplingDecision))
| 119 | // } |
| 120 | // }) |
| 121 | func SamplerHook(hook func(entry Entry, dec SamplingDecision)) SamplerOption { |
| 122 | return optionFunc(func(s *sampler) { |
| 123 | s.hook = hook |
| 124 | }) |
| 125 | } |
| 126 | |
| 127 | // NewSamplerWithOptions creates a Core that samples incoming entries, which |
| 128 | // caps the CPU and I/O load of logging while attempting to preserve a |