-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept capital strings in Level.UnmarshalText #435
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just strings.ToLower(string(text))
so that we accept debug
Debug
and DEBUG
?
|
@jcorbin What do you think of pulling out the switch into a separate function and making two attempts at parsing - once with the original string, and once with the lowercased version if the first pass fails? That keeps the success case fast, but successfully parses a wider array of reasonably well-formed inputs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent.
Makes it easier to parse zap's own log output (especially since capital level strings is our internal standard).