MCPcopy
hub / github.com/rs/zerolog / BenchmarkContextAppend

Function BenchmarkContextAppend

benchmark_test.go:60–70  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

58}
59
60func BenchmarkContextAppend(b *testing.B) {
61 logger := New(io.Discard).With().
62 Str("foo", "bar").
63 Logger()
64 b.ResetTimer()
65 b.RunParallel(func(pb *testing.PB) {
66 for pb.Next() {
67 logger.With().Str("bar", "baz")
68 }
69 })
70}
71
72func BenchmarkLogFields(b *testing.B) {
73 logger := New(io.Discard)

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
LoggerMethod · 0.80
WithMethod · 0.80
NextMethod · 0.65
StrMethod · 0.45

Tested by

no test coverage detected