MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestSpanLogger_Log

Function TestSpanLogger_Log

pkg/util/spanlogger/spanlogger_test.go:15–25  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestSpanLogger_Log(t *testing.T) {
16 span, ctx := New(context.Background(), "test", "bar")
17 _ = span.Log("foo")
18 newSpan := FromContext(ctx)
19 require.Equal(t, span.Span, newSpan.Span)
20 _ = newSpan.Log("bar")
21 noSpan := FromContext(context.Background())
22 _ = noSpan.Log("foo")
23 require.Error(t, noSpan.Error(errors.New("err")))
24 require.NoError(t, noSpan.Error(nil))
25}
26
27func TestSpanLogger_CustomLogger(t *testing.T) {
28 var logged [][]any

Callers

nothing calls this directly

Calls 5

NewFunction · 0.70
FromContextFunction · 0.70
EqualMethod · 0.65
LogMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected