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

Function TestTaskRunLogContext

backend/runner/taskrun/log_context_test.go:23–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestTaskRunLogContext(t *testing.T) {
24 var buf bytes.Buffer
25 logger := slog.New(log.NewContextHandler(slog.NewTextHandler(&buf, nil)))
26
27 ctx := taskRunLogContext(context.Background(), "project-a", 123)
28 logger.InfoContext(ctx, "task run started")
29
30 output := buf.String()
31 require.Contains(t, output, `project=project-a`)
32 require.Contains(t, output, `task_run_id=123`)
33}

Callers

nothing calls this directly

Calls 3

NewContextHandlerFunction · 0.92
taskRunLogContextFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected