MCPcopy Index your code
hub / github.com/DoNewsCode/core / TestPerformanceOptimization

Function TestPerformanceOptimization

logging/log_test.go:81–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

79}
80
81func TestPerformanceOptimization(t *testing.T) {
82 var buf bytes.Buffer
83 for _, c := range []struct {
84 name string
85 logger log.Logger
86 }{
87 {
88 "json",
89 log.NewJSONLogger(&buf),
90 },
91 {
92 "logfmt",
93 log.NewLogfmtLogger(&buf),
94 },
95 } {
96 t.Run(c.name, func(t *testing.T) {
97 l := level.NewFilter(c.logger, LevelFilter("error"))
98 ll := WithLevel(l)
99 ll.Debug(mockValue{})
100 ll.Debugw("bar", "foo", mockValue{})
101 ll.Debugf("%s", mockValue{})
102 })
103 }
104}

Callers

nothing calls this directly

Calls 6

LevelFilterFunction · 0.85
WithLevelFunction · 0.85
DebugMethod · 0.65
DebugwMethod · 0.65
DebugfMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected