github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/logging/gokit_test.go (about) 1 package logging 2 3 import ( 4 "testing" 5 6 "github.com/go-kit/log" 7 "github.com/go-kit/log/level" 8 ) 9 10 func BenchmarkDebugf(b *testing.B) { 11 lvl := Level{Gokit: level.AllowInfo()} 12 g := log.NewNopLogger() 13 logger := addStandardFields(g, lvl) 14 // Simulate the parameters used in middleware/logging.go 15 var ( 16 method = "method" 17 uri = "https://example.com/foobar" 18 statusCode = 404 19 duration = 42 20 ) 21 b.ResetTimer() 22 for i := 0; i < b.N; i++ { 23 logger.Debugf("%s %s (%d) %s", method, uri, statusCode, duration) 24 } 25 }