-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add Process ID to formatters #463
Conversation
Signed-off-by: Michael Honaker <[email protected]>
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.
Two small nits. Nice addition!
src/python/alog/alog.py
Outdated
@@ -25,7 +25,7 @@ | |||
logging package with a number of additional features, including log channels, | |||
configurable formatting and scoped loggers. | |||
""" | |||
|
|||
import os |
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.
NIT: Please sort these alphabetically
src/python/alog/alog.py
Outdated
thread_id: bool =False, | ||
handler_generator: Optional[Callable[[], logging.Handler]] = None, | ||
process_id: bool =False, |
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.
thread_id: bool =False, | |
handler_generator: Optional[Callable[[], logging.Handler]] = None, | |
process_id: bool =False, | |
thread_id: bool = False, | |
handler_generator: Optional[Callable[[], logging.Handler]] = None, | |
process_id: bool = False, |
Signed-off-by: Michael Honaker <[email protected]>
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.
Ok, nice! I think there are a few more things we should add to make this maximally useful:
- It should be handled in the pretty formatter. I'd suggest adding it right next to the
thread_id
(here) so that it formats as:<thread_id>:P<proc_id>
- We should add unit tests. This would look like adding it to the pretty print parsing, then replicating the tests for
thread_id
and making sure we handle having both/one/neither.
@gabe-l-hart darn you trying to enforce good code etiquette. Let me push a commit |
Signed-off-by: Michael Honaker <[email protected]>
b2542b3
to
04a4f9f
Compare
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 putting up with me Casey!
Description
This PR adds the ability for formatters to optionally include the process_id in the log message. This is useful for multi-process applications.
Changes
Add new option to python alog.configure.
Testing
Tested locally
Related Issue(s)
List any issues related to this PR