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

Function BenchmarkLogFields

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

Source from the content-addressed store, hash-verified

70}
71
72func BenchmarkLogFields(b *testing.B) {
73 logger := New(io.Discard)
74 b.ResetTimer()
75 b.RunParallel(func(pb *testing.PB) {
76 for pb.Next() {
77 logger.Info().
78 Str("string", "four!").
79 Time("time", time.Time{}).
80 Int("int", 123).
81 Float32("float", -2.203230293249593).
82 Msg(fakeMessage)
83 }
84 })
85}
86
87func BenchmarkLogArrayObject(b *testing.B) {
88 obj1 := fixtureObj{"a", "b", 2}

Callers

nothing calls this directly

Calls 8

NewFunction · 0.85
MsgMethod · 0.80
NextMethod · 0.65
InfoMethod · 0.65
Float32Method · 0.45
IntMethod · 0.45
TimeMethod · 0.45
StrMethod · 0.45

Tested by

no test coverage detected