-
Notifications
You must be signed in to change notification settings - Fork 421
fix(logger): remove subclassing and move unnecessary APIs #2334
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
Merged
leandrodamascena
merged 8 commits into
aws-powertools:develop
from
heitorlessa:fix/logger-subclassing
Jun 1, 2023
Merged
fix(logger): remove subclassing and move unnecessary APIs #2334
leandrodamascena
merged 8 commits into
aws-powertools:develop
from
heitorlessa:fix/logger-subclassing
Jun 1, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* 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)
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #2334 +/- ##
========================================
Coverage 97.21% 97.21%
========================================
Files 152 153 +1
Lines 6998 7006 +8
Branches 513 513
========================================
+ Hits 6803 6811 +8
Misses 155 155
Partials 40 40
☔ View full report in Codecov by Sentry. |
rubenfonseca
approved these changes
May 26, 2023
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.
Awesome!
roger-zhangg
pushed a commit
to roger-zhangg/aws-lambda-powertools-python
that referenced
this pull request
Jun 5, 2023
…owertools#2334) Co-authored-by: Leandro Damascena <[email protected]>
sthulb
pushed a commit
that referenced
this pull request
Jun 19, 2023
Co-authored-by: Leandro Damascena <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
enhancement
logger
size/L
Denotes a PR that changes 100-499 lines, ignoring generated files.
tech-debt
Technical Debt tasks
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue number: #2356
Summary
Long standing tech debt to remove
logging.Logger
sub-classing, and move backwards compatible private functions tocompat.py
to keep Logger public API cleaner.Why?
If we were to add
__getattr__
,mypy
would then fail to detect non-existent objects likelogger.foo
, because it can't infer from that.Changes
compat.py
.registered_handler
andregistered_formatter
to say it picks up the original handler only for convenience.log_level
to_logger.level
to make it less error-proneHistorical events that made this possible now (older to recent)
setLevel
method to correctly apply level in private loggerUser experience
Escape hatching to standard python logging methods like
addHandler
,setLevel
will work as expected and effect the underlying logger. However,mypy
customers will receive a error at type checking - if necessary, we can port these into our Logger API on a per case basis.Output
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.