Skip to content

Conversation

@CuriousLearner
Copy link
Member

@CuriousLearnerCuriousLearner commented Aug 2, 2018

@CuriousLearner
Copy link
MemberAuthor

CuriousLearner commented Aug 7, 2018

@vsajip Hello, I see that there are various linting errors in test_logging.py which were fixed in 5f63c20. Does it make sense to separate them out in another Pull Request?

@willingcwillingc self-requested a review October 7, 2018 09:23
@CuriousLearner
Copy link
MemberAuthor

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!

@willingc
Copy link
Contributor

@CuriousLearner I would go ahead and rebase to resolve conflicts.

@CuriousLearner
Copy link
MemberAuthor

@willingc Done!

raise LineTooLong("status line")
if self.debuglevel > 0:
print("reply:", repr(line))
_log.info("reply:{}".format(repr(line)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

import io
import itertools
import os
import sys

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't being used anywhere!?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good catch. I think it remained here while I was working on this.

logger = logging.getLogger("http")
root_logger = self.root_logger
root_logger.removeHandler(self.root_logger.handlers[0])
logger = logging.getLogger("httplogger")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this name change?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no specific reason for it. I'll just revert back.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the stale Stale PR or inactive for long period of time. label Dec 15, 2024
@picnixzpicnixz changed the title bpo-24255: Replace debug level-related logic in http client with logginggh-68443: Replace debug level-related logic in http client with loggingDec 15, 2024
@github-actionsgithub-actionsbot removed the stale Stale PR or inactive for long period of time. label Feb 27, 2025
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the stale Stale PR or inactive for long period of time. label Apr 13, 2025
@python-cla-bot
Copy link

python-cla-botbot commented Apr 18, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@github-actionsgithub-actionsbot removed the stale Stale PR or inactive for long period of time. label Apr 18, 2025
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the stale Stale PR or inactive for long period of time. label Jun 15, 2025
@github-actionsgithub-actionsbot removed the stale Stale PR or inactive for long period of time. label Oct 12, 2025
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the stale Stale PR or inactive for long period of time. label Nov 11, 2025
@CuriousLearnerCuriousLearner removed the stale Stale PR or inactive for long period of time. label Nov 14, 2025
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.
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the stale Stale PR or inactive for long period of time. label Jan 6, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviewstaleStale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@CuriousLearner@willingc@vsajip@asvetlov@dhilst@the-knights-who-say-ni@ezio-melotti@bedevere-bot