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
()
| 92 | // // logging is set to Error for the whole test |
| 93 | // } |
| 94 | func 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 |
no outgoing calls