log icon indicating copy to clipboard operation
log copied to clipboard

Level.String panics if Level == InvalidLevel

Open clementauger opened this issue 4 years ago • 1 comments

hi,

the method LeveL.String panics when Level==InvalidLevel.

https://github.com/apex/log/blob/master/levels.go#L44 https://github.com/apex/log/blob/master/levels.go#L17

I suggest to add a statement before the slice access so that this pseudo value does not appear in the levelNames / levelStrings variables.

It could return an empty string or something like invalid

clementauger avatar Oct 15 '19 19:10 clementauger

👍 sounds good to me

tj avatar Oct 18 '19 09:10 tj