MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestContextHandlerSkipsEmptyContext

Function TestContextHandlerSkipsEmptyContext

backend/common/log/context_test.go:28–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestContextHandlerSkipsEmptyContext(t *testing.T) {
29 var buf bytes.Buffer
30 logger := slog.New(NewContextHandler(slog.NewTextHandler(&buf, nil)))
31
32 logger.InfoContext(context.Background(), "migration started")
33
34 output := buf.String()
35 require.Contains(t, output, `msg="migration started"`)
36 require.NotContains(t, output, `project=`)
37 require.NotContains(t, output, `task_run_id=`)
38}

Callers

nothing calls this directly

Calls 2

NewContextHandlerFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected