-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Pass Severity instead of String to Logger::Formatter #4369
Pass Severity instead of String to Logger::Formatter #4369
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.
Thanks for this @Sija (that was fast! :)). On reviewing this I noticed there's zero documentation for the Formatter. Could we add that as part of this PR? This is a breaking change so having at least basic documentation will help users fix their programs faster.
|
||
private DEFAULT_FORMATTER = Formatter.new do |severity, datetime, progname, message, io| | ||
io << severity[0] << ", [" << datetime << " #" << Process.pid << "] " | ||
io << severity.rjust(5) << " -- " << progname << ": " << message | ||
label = severity.unknown? ? "ANY" : severity.to_s |
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.
Why not just use "U" (for "Unknown")?
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.
I just copy-pasted this line from previous version. Why not just severity.to_s
without branching into other symbols?
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.
Hadn't noticed it was already like that. Then let's just leave it like this.
@mverzilli done. |
@Sija I meant to document the
Btw, I would have liked to directly add a commit to the PR without bothering you, but I'm not sure what the best workflow for doing it is :(. |
e0d1635
to
a286471
Compare
@mverzilli I think maintainers can push directly to most PRs now. |
a286471
to
e1186e0
Compare
I've force-pushed the last commit with your docs added. In the future it's fine with me if you'd do it yourself. I've took a liberty to modify some interpunction and wording here & there if that's ok with you. |
|
@Sija that box is checked by default now though, so I imagine most prs don't bother to change it. |
Nice, it does work :). |
Fixes #4355