-
Notifications
You must be signed in to change notification settings - Fork 421
fix(logger): add setLevel function to set level programmatically #2320
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
fix(logger): add setLevel function to set level programmatically #2320
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.
one tiny change and LGTM. Also a reminder for us that this is a workaround until we have a way to fix proxy object (__getattribute__
and __getattr__
) while keeping mypy detecting non-existent attrs.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #2320 +/- ##
========================================
Coverage 97.46% 97.47%
========================================
Files 149 150 +1
Lines 6901 6925 +24
Branches 509 509
========================================
+ Hits 6726 6750 +24
Misses 137 137
Partials 38 38
☔ View full report in Codecov by Sentry. |
NOTE for future when we do this properly...
Then we can remove these ugly workarounds, including things like def __getattribute__(self, item):
try:
# Return actual item from our class first (e.g., append_keys, etc.)
return object.__getattribute__(self, item)
except AttributeError:
# Return actual item from the underlying logger (e.g., setLevel, addHandler, etc.)
return self._logger.__getattribute__(item) |
* develop: chore(deps-dev): bump aws-cdk from 2.80.0 to 2.81.0 (aws-powertools#2332) chore(deps-dev): bump coverage from 7.2.5 to 7.2.6 (aws-powertools#2326) chore(deps-dev): bump pytest-cov from 4.0.0 to 4.1.0 (aws-powertools#2327) chore(deps): bump actions/setup-python from 4.6.0 to 4.6.1 (aws-powertools#2325) fix(docs): use concrete secrets from settings (aws-powertools#2322) fix(logger): add setLevel function to set level programmatically (aws-powertools#2320) feat(parser): add support for parsing SQS events wrapped in Kinesis Firehose (aws-powertools#2294)
Issue number: #2303
Summary
Changes
When changing the logging level of a Logger via code, the logging level must be changed. With the current implementation, this was not happening because it was modifying the superclass and not the Logger instance. This PR aims to fix that.
User experience
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.