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

Function TestEntryFormatterRace

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

Source from the content-addressed store, hash-verified

289}
290
291func TestEntryFormatterRace(t *testing.T) {
292 logger := New()
293 entry := NewEntry(logger)
294
295 // logging before SetReportCaller has the highest chance of causing a race condition
296 // to be detected, but doing it twice just to increase the likelihood of detecting the race
297 go func() {
298 entry.Info("should not race")
299 }()
300 go func() {
301 logger.SetFormatter(&TextFormatter{})
302 }()
303 go func() {
304 entry.Info("should not race")
305 }()
306}

Callers

nothing calls this directly

Calls 4

InfoMethod · 0.95
NewFunction · 0.85
NewEntryFunction · 0.85
SetFormatterMethod · 0.80

Tested by

no test coverage detected