Fix infinite recursion on unknown Level.String()

Using `%q` in the error string causes `MarshalText` to recurse (by calling String()).
This commit is contained in:
noushavandijk
2019-02-20 18:22:53 +01:00
committed by Richard Poirier
parent cdb2f3857c
commit 4f5fd631f1
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -521,6 +521,13 @@ func TestParseLevel(t *testing.T) {
assert.Equal(t, "not a valid logrus Level: \"invalid\"", err.Error())
}
func TestLevelString(t *testing.T) {
var loggerlevel Level
loggerlevel = 32000
_ = loggerlevel.String()
}
func TestGetSetLevelRace(t *testing.T) {
wg := sync.WaitGroup{}
for i := 0; i < 100; i++ {