author | Alberto Bertogli
<albertito@blitiri.com.ar> 2020-05-22 16:25:15 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2020-05-22 16:53:56 UTC |
parent | 7d576e76b9c51ca5d649d6507d7e367946ad0355 |
log_test.go | +18 | -0 |
diff --git a/log_test.go b/log_test.go index 1ce9883..799ada8 100644 --- a/log_test.go +++ b/log_test.go @@ -191,3 +191,21 @@ func TestReopenNull(t *testing.T) { t.Errorf("reopen: %v", err) } } + +// Benchmark a call below the verbosity level. +func BenchmarkDebugf(b *testing.B) { + l := New(nopCloser{ioutil.Discard}) + defer l.Close() + for i := 0; i < b.N; i++ { + l.Debugf("test %d", i) + } +} + +// Benchmark a normal call. +func BenchmarkInfof(b *testing.B) { + l := New(nopCloser{ioutil.Discard}) + defer l.Close() + for i := 0; i < b.N; i++ { + l.Infof("test %d", i) + } +}