MCPcopy
hub / github.com/keploy/keploy / TestSetGetDebugFileSink

Function TestSetGetDebugFileSink

utils/log/logger_test.go:494–511  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

492}
493
494func TestSetGetDebugFileSink(t *testing.T) {
495 SetRedactor(nil)
496 defer SetDebugFileSink(nil)
497
498 if got := GetDebugFileSink(); got != nil {
499 t.Errorf("GetDebugFileSink with nothing registered: got %v, want nil", got)
500 }
501
502 logger := newConsoleLogger(&syncBuffer{}, zap.InfoLevel)
503 tmp, _ := os.CreateTemp(t.TempDir(), "global-*.log")
504 defer tmp.Close()
505 _, sink := AddDebugFileSink(logger, tmp, 0)
506 SetDebugFileSink(sink)
507
508 if got := GetDebugFileSink(); got != sink {
509 t.Errorf("GetDebugFileSink: got %v, want %v", got, sink)
510 }
511}
512
513func BenchmarkAddDebugFileSink_Write(b *testing.B) {
514 SetRedactor(nil)

Callers

nothing calls this directly

Calls 6

SetRedactorFunction · 0.85
SetDebugFileSinkFunction · 0.85
GetDebugFileSinkFunction · 0.85
newConsoleLoggerFunction · 0.85
AddDebugFileSinkFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected