MCPcopy
hub / github.com/uber-go/zap / makeSamplerCountingHook

Function makeSamplerCountingHook

config_test.go:146–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144}
145
146func makeSamplerCountingHook() (h func(zapcore.Entry, zapcore.SamplingDecision),
147 dropped, sampled *atomic.Int64,
148) {
149 dropped = new(atomic.Int64)
150 sampled = new(atomic.Int64)
151 h = func(_ zapcore.Entry, dec zapcore.SamplingDecision) {
152 if dec&zapcore.LogDropped > 0 {
153 dropped.Add(1)
154 } else if dec&zapcore.LogSampled > 0 {
155 sampled.Add(1)
156 }
157 }
158 return h, dropped, sampled
159}
160
161func TestConfigWithSamplingHook(t *testing.T) {
162 shook, dcount, scount := makeSamplerCountingHook()

Callers 1

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected