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