gh-68443: Replace debug level-related logic in http client with logging#8633
gh-68443: Replace debug level-related logic in http client with logging#8633CuriousLearner wants to merge 1 commit intopython:mainfrom
Conversation
|
Hey @bitdancer , @vsajip Can you please have a look at this? I just noticed this PR wasn't reviewed from almost a year. Please let me know, what is needed here. Thanks! |
|
@CuriousLearner I would go ahead and rebase to resolve conflicts. |
|
@willingc Done! |
Lib/http/client.py
Outdated
There was a problem hiding this comment.
logging first argument support old format string, so _log.info("reply: %s", repr(line)) would work. There is mixed calls of {}".format(foo with %s", foo, wouldn't be better to stick with one?
There was a problem hiding this comment.
wouldn't be better to stick with one?
I agree - % should work fine and a lot of logging uses %-formatting rather than .format() due to its age.
There was a problem hiding this comment.
There is another reason: tools like Sentry use message pattern as a key for logs grouping.
Adding pre-formatted messages to Sentry is very ineffective.
There was a problem hiding this comment.
Ah, sorry!
I think I came back to this later and followed the same style as for other Python projects I was involved with.
Fixing this!
Lib/test/test_httplib.py
Outdated
There was a problem hiding this comment.
Yeah, good catch. I think it remained here while I was working on this.
Lib/test/test_logging.py
Outdated
There was a problem hiding this comment.
There is no specific reason for it. I'll just revert back.
|
This PR is stale because it has been open for 30 days with no activity. |
|
This PR is stale because it has been open for 30 days with no activity. |
|
This PR is stale because it has been open for 30 days with no activity. |
|
This PR is stale because it has been open for 30 days with no activity. |
9933ad5 to
b6997e1
Compare
Replace debuglevel-based print statements with Python's standard logging module for better integration with logging frameworks and log aggregation tools like Sentry. Uses % formatting consistently for better log pattern matching in aggregation tools.
c240289 to
afeb73c
Compare
|
This PR is stale because it has been open for 30 days with no activity. |
Hey @bitdancer , here's the PR for issue: https://bugs.python.org/issue24255
https://bugs.python.org/issue24255