MCPcopy
hub / github.com/op/go-logging / TestPrivateBackend

Function TestPrivateBackend

logger_test.go:48–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestPrivateBackend(t *testing.T) {
49 stdBackend := InitForTesting(DEBUG)
50 log := MustGetLogger("test")
51 privateBackend := NewMemoryBackend(10240)
52 lvlBackend := AddModuleLevel(privateBackend)
53 lvlBackend.SetLevel(DEBUG, "")
54 log.SetBackend(lvlBackend)
55 log.Debug("to private backend")
56 if stdBackend.size > 0 {
57 t.Errorf("something in stdBackend, size of backend: %d", stdBackend.size)
58 }
59 if "to private baсkend" == MemoryRecordN(privateBackend, 0).Formatted(0) {
60 t.Error("logged to defaultBackend:", MemoryRecordN(privateBackend, 0))
61 }
62}

Callers

nothing calls this directly

Calls 11

InitForTestingFunction · 0.85
MustGetLoggerFunction · 0.85
NewMemoryBackendFunction · 0.85
AddModuleLevelFunction · 0.85
MemoryRecordNFunction · 0.85
SetBackendMethod · 0.80
DebugMethod · 0.80
ErrorfMethod · 0.80
FormattedMethod · 0.80
ErrorMethod · 0.80
SetLevelMethod · 0.65

Tested by

no test coverage detected