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

Function BenchmarkAddCallerHook

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

Source from the content-addressed store, hash-verified

166}
167
168func BenchmarkAddCallerHook(b *testing.B) {
169 logger := New(
170 zapcore.NewCore(
171 zapcore.NewJSONEncoder(NewProductionConfig().EncoderConfig),
172 &ztest.Discarder{},
173 InfoLevel,
174 ),
175 AddCaller(),
176 )
177 b.ResetTimer()
178 b.RunParallel(func(pb *testing.PB) {
179 for pb.Next() {
180 logger.Info("Caller.")
181 }
182 })
183}
184
185func BenchmarkAddCallerAndStacktrace(b *testing.B) {
186 logger := New(

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…