(b *testing.B)
| 511 | } |
| 512 | |
| 513 | func BenchmarkAddDebugFileSink_Write(b *testing.B) { |
| 514 | SetRedactor(nil) |
| 515 | console := &syncBuffer{} |
| 516 | base := newConsoleLogger(console, zap.InfoLevel) |
| 517 | |
| 518 | tmpDir := b.TempDir() |
| 519 | tmp, err := os.OpenFile(filepath.Join(tmpDir, "bench.log"), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o644) |
| 520 | if err != nil { |
| 521 | b.Fatalf("open: %v", err) |
| 522 | } |
| 523 | defer tmp.Close() |
| 524 | wrapped, sink := AddDebugFileSink(base, tmp, 0) |
| 525 | defer sink.Flush() |
| 526 | |
| 527 | b.ResetTimer() |
| 528 | for i := 0; i < b.N; i++ { |
| 529 | wrapped.Debug("bench", zap.Int("i", i), zap.String("k", "value")) |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | func BenchmarkBaseline_Write(b *testing.B) { |
| 534 | SetRedactor(nil) |
nothing calls this directly
no test coverage detected