Add another benchmark.
@@ -76,7 +76,7 @@ func BenchmarkWithOutTransaction(b *testing.B) {
}
}
-func BenchmarkWithOutLogDecoration(b *testing.B) {
+func BenchmarkJSONFormatter(b *testing.B) {
log := newTestLogger(bytes.NewBuffer([]byte("")))
log.Formatter = new(logrus.JSONFormatter)
ctx := context.Background()
@@ -89,6 +89,19 @@ func BenchmarkWithOutLogDecoration(b *testing.B) {
}
}
+func BenchmarkTextFormatter(b *testing.B) {
+ log := newTestLogger(bytes.NewBuffer([]byte("")))
+ log.Formatter = new(logrus.TextFormatter)
+ ctx := context.Background()
+
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ log.WithContext(ctx).Info("Hello World!")
+ }
+}
+
func BenchmarkWithTransaction(b *testing.B) {
app := testApp(nil, nil, nil)
txn := app.StartTransaction("TestLogDistributedTracingDisabled", nil, nil)
