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

Function BenchmarkAddCallerAndStacktrace

logger_bench_test.go:185–201  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

183}
184
185func BenchmarkAddCallerAndStacktrace(b *testing.B) {
186 logger := New(
187 zapcore.NewCore(
188 zapcore.NewJSONEncoder(NewProductionConfig().EncoderConfig),
189 &ztest.Discarder{},
190 InfoLevel,
191 ),
192 AddCaller(),
193 AddStacktrace(WarnLevel),
194 )
195 b.ResetTimer()
196 b.RunParallel(func(pb *testing.PB) {
197 for pb.Next() {
198 logger.Warn("Caller and stacktrace.")
199 }
200 })
201}
202
203func Benchmark5WithsUsed(b *testing.B) {
204 benchmarkWithUsed(b, (*Logger).With, 5, true)

Callers

nothing calls this directly

Calls 8

NewCoreFunction · 0.92
NewJSONEncoderFunction · 0.92
NewProductionConfigFunction · 0.85
AddCallerFunction · 0.85
AddStacktraceFunction · 0.85
NextMethod · 0.80
NewFunction · 0.70
WarnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…