MCPcopy
hub / github.com/gofiber/fiber / Test_WithContextCaller

Function Test_WithContextCaller

log/default_test.go:57–75  ·  view source on GitHub ↗

Test_WithContextCaller runs serially because it mutates the package-global logger and output to verify caller attribution.

(t *testing.T)

Source from the content-addressed store, hash-verified

55// Test_WithContextCaller runs serially because it mutates the package-global
56// logger and output to verify caller attribution.
57func Test_WithContextCaller(t *testing.T) {
58 t.Cleanup(initDefaultLogger)
59
60 logger = &defaultLogger{
61 stdlog: log.New(os.Stderr, "", log.Lshortfile),
62 depth: 4,
63 }
64
65 var w byteSliceWriter
66 SetOutput(&w)
67 ctx := context.TODO()
68
69 withContextLine := callSiteLine(t) + 1
70 WithContext(ctx).Info("")
71 infoLine := callSiteLine(t) + 1
72 Info("")
73
74 expectCallerOutput(t, &w, withContextLine, infoLine)
75}
76
77// Test_WithContextNilCaller runs serially because it mutates the package-global
78// logger and output to verify caller attribution.

Callers

nothing calls this directly

Calls 7

SetOutputFunction · 0.85
callSiteLineFunction · 0.85
WithContextFunction · 0.85
InfoFunction · 0.85
expectCallerOutputFunction · 0.85
NewMethod · 0.65
InfoMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…