MCPcopy
hub / github.com/sirupsen/logrus / TestEntryReportCallerRace

Function TestEntryReportCallerRace

entry_test.go:274–289  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

272}
273
274func TestEntryReportCallerRace(t *testing.T) {
275 logger := New()
276 entry := NewEntry(logger)
277
278 // logging before SetReportCaller has the highest chance of causing a race condition
279 // to be detected, but doing it twice just to increase the likelihood of detecting the race
280 go func() {
281 entry.Info("should not race")
282 }()
283 go func() {
284 logger.SetReportCaller(true)
285 }()
286 go func() {
287 entry.Info("should not race")
288 }()
289}
290
291func TestEntryFormatterRace(t *testing.T) {
292 logger := New()

Callers

nothing calls this directly

Calls 4

InfoMethod · 0.95
NewFunction · 0.85
NewEntryFunction · 0.85
SetReportCallerMethod · 0.80

Tested by

no test coverage detected