-
Notifications
You must be signed in to change notification settings - Fork 421
Feature request: Add BaseException.__notes__ to log messages #6441
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
Comments
Hi @waffleshop! Thanks for opening this issue! Yes, I think it makes a lot of sense to serialize the notes added when logging an exception or error with Notes are supported in Python 3.11+ and Powertools supports 3.9+, so we need to add a condition when serializing the exception to check if the Python version is 3.11+ or just if the Would you like to submit a PR to implement this? I'd love to have your contribution here. |
|
This is now released under 3.11.0 version! |
Use case
As a developer, I would like PowerTools' Logging to support the notes feature (
BaseException.__notes__
) so my log messages can be enriched with data and code natively available via Python exceptions.Solution/User Experience
PowerTools' log messages include a
notes: list[str]
attribute populated by Python'sBaseException.__notes__
.The common use case is when you want to add context to a potential exception but not explicitly log at the time.
Ideally, the log message would then include a
notes
attribute:Alternative solutions
Acknowledgment
The text was updated successfully, but these errors were encountered: