MCPcopy
hub / github.com/netdata/netdata / TestNew

Function TestNew

src/go/logger/logger_test.go:12–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestNew(t *testing.T) {
13 tests := map[string]*Logger{
14 "default logger": New(),
15 "nil logger": nil,
16 }
17
18 for name, logger := range tests {
19 t.Run(name, func(t *testing.T) {
20 f := func() {
21 logger.Infof("test %s", "test")
22 logger.When(true).Warning("warn").Else().Info("info")
23 logger.Once("k").Info("once")
24 logger.Limit("k", 1, time.Second).Info("limit")
25 logger.ResetAllOnce()
26 }
27 assert.NotPanics(t, f)
28 })
29 }
30}
31
32func TestNewWithWriter(t *testing.T) {
33 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 10

ElseMethod · 0.80
WhenMethod · 0.80
OnceMethod · 0.80
LimitMethod · 0.80
ResetAllOnceMethod · 0.80
NewFunction · 0.70
RunMethod · 0.65
InfofMethod · 0.65
InfoMethod · 0.65
WarningMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…