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

Function BenchmarkLogStack

pkgerrors/stacktrace_test.go:79–90  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

77}
78
79func BenchmarkLogStack(b *testing.B) {
80 zerolog.ErrorStackMarshaler = MarshalStack
81 out := &bytes.Buffer{}
82 log := zerolog.New(out)
83 err := errors.Wrap(errors.New("error message"), "from error")
84 b.ReportAllocs()
85
86 for i := 0; i < b.N; i++ {
87 log.Log().Stack().Err(err).Msg("")
88 out.Reset()
89 }
90}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
MsgMethod · 0.80
ResetMethod · 0.80
ErrMethod · 0.65
LogMethod · 0.65
StackMethod · 0.45

Tested by

no test coverage detected