2017-03-31 19:01:58 +03:00
|
|
|
package log_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/go-kit/kit/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) {
|
2017-05-18 19:54:23 +03:00
|
|
|
lc := log.NewContext(logger).With("common_key", "common_value")
|
2017-03-31 19:01:58 +03:00
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
f(lc)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
baseMessage = func(logger log.Logger) { logger.Log("foo_key", "foo_value") }
|
2017-05-18 19:54:23 +03:00
|
|
|
withMessage = func(logger log.Logger) { log.NewContext(logger).With("a", "b").Log("c", "d") }
|
2017-03-31 19:01:58 +03:00
|
|
|
)
|