log: fix issues with benchmarks (#30667)

This commit is contained in:
Daniel Liu 2024-11-15 10:02:43 +08:00
parent 54f8e028ca
commit 5bfaf068a4

View file

@ -7,7 +7,6 @@ import (
"io" "io"
"log/slog" "log/slog"
"math/big" "math/big"
"os"
"strings" "strings"
"testing" "testing"
"time" "time"
@ -70,7 +69,7 @@ func TestJSONHandler(t *testing.T) {
} }
func BenchmarkTraceLogging(b *testing.B) { func BenchmarkTraceLogging(b *testing.B) {
SetDefault(NewLogger(NewTerminalHandler(os.Stderr, true))) SetDefault(NewLogger(NewTerminalHandler(io.Discard, true)))
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
Trace("a message", "v", i) Trace("a message", "v", i)