Use a sync.Once to init the reportCaller data

This commit is contained in:
David Bariod
2018-10-27 15:21:30 +02:00
parent 5fcd19eae6
commit 975c406ddb
2 changed files with 21 additions and 13 deletions
+2 -2
View File
@@ -92,7 +92,7 @@ func logSomething(t *testing.T, message string) Fields {
logger.ReportCaller = true
// override the filter to allow reporting of functions within the logrus package
LogrusPackage = "bogusForTesting"
logrusPackage = "bogusForTesting"
entry := logger.WithFields(Fields{
"foo": "bar",
@@ -104,7 +104,7 @@ func logSomething(t *testing.T, message string) Fields {
assert.Nil(t, err)
// now clear the override so as not to mess with other usage
LogrusPackage = ""
logrusPackage = ""
return fields
}