MCPcopy Create free account
hub / github.com/AdRoll/baker / LessLogging

Function LessLogging

testutil/helpers.go:94–98  ·  view source on GitHub ↗

LessLogging is a test helper that decreases logging (in fact it sets its level to Error). It returns a function which when called, resets it to its previous level. Its useful to be called as follows in test/benchmarks: func TestFoo(t *testing.T) { defer LessLogging()() logging is set to Error for

()

Source from the content-addressed store, hash-verified

92// // logging is set to Error for the whole test
93// }
94func LessLogging() (reset func()) {
95 lvl := log.GetLevel()
96 log.SetLevel(log.ErrorLevel)
97 return func() { log.SetLevel(lvl) }
98}
99
100// SetLogLevel sets the global log level for the execution of the current tb.
101// Though setting the log level is safe for use from concurrent goroutines, it's

Callers 4

TestFileWriterConfigFunction · 0.92
TestFileWriterRotateSizeFunction · 0.92

Calls

no outgoing calls

Tested by 4

TestFileWriterConfigFunction · 0.74
TestFileWriterRotateSizeFunction · 0.74