MCPcopy
hub / github.com/netdata/netdata / TestContextWithLoggerAndLoggerFromContext

Function TestContextWithLoggerAndLoggerFromContext

src/go/logger/context_test.go:12–20  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestContextWithLoggerAndLoggerFromContext(t *testing.T) {
13 log := New()
14
15 ctx := ContextWithLogger(nil, log)
16 got, ok := LoggerFromContext(ctx)
17
18 assert.True(t, ok)
19 assert.Same(t, log, got)
20}
21
22func TestContextWithLogger_IgnoresNilLogger(t *testing.T) {
23 ctx := ContextWithLogger(context.Background(), nil)

Callers

nothing calls this directly

Calls 3

ContextWithLoggerFunction · 0.85
LoggerFromContextFunction · 0.85
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…