Allow tweaking the presentation style of logged errors
See original GitHub issueContext
What are you trying to do?
I’ve been trying to improve pip’s output (hopefully, you’ve noticed!) and our networking-related output seems like a really good candidate to try to improve. This includes various kinds of errors originating from urllib3 and especially the presentation when there’s going to be a retry.
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x10439a3a0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known')': /simple/foooooooooooooo/
How do you expect to do it?
Would it be OK to change that into multiple log messages, at debug and warning levels? That way, the logging presentation would look like:
WARNING: Connection broken to /simple/foooooooooooooo/
WARNING: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known
DEBUG: NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x10439a3a0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known')
WARNING: Will retry connection (3 remaining retries)
DEBUG: Retry(total=3, connect=None, read=None, redirect=None, status=None)
While a “regular” output would be:
WARNING: Connection broken to /simple/foooooooooooooo/
WARNING: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known
WARNING: Will retry connection (3 remaining retries)
I mean, honestly, an ideal solution would probably look like some way to hook into pip’s new error message presentation:
warning: will-retry-network-failure
× Retrying connection to https://pypi.org/simple/foooooooooooooo/
╰─> Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known
Remaining retries: 3
note: This is an issue with the network connection.
Is it something you currently cannot do? Nope.
Is this related to an existing issue/problem? Nope.
Alternatives
Can you achieve the same result doing it in an alternative way? I looked, and the only thing I could think of is a hacky formatter for urllib3. 🤷🏽
Is the alternative considerable? 🤷🏽
Duplicate
Has the feature been requested before? Not that I could find.
Contribution
Would you be willing to submit a PR? Depends on what level of complexity is involved in implementing this, and how aggressively we scope-creep on this. 😃 (Help can be provided if you need assistance submitting a PR)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:16 (16 by maintainers)
Top GitHub Comments
Ooops, I didn’t realise that sentence would come across in that way – I was merely pointing out that you’re the only contributor/maintainer who’s engaged in this issue so far, and that you didn’t like the suggestions made in OP, and that no other maintainer has engaged so far.
In case it isn’t clear from the above: I don’t have a problem with you. 😃
Not a fan of making free promises, but that values coincide with mine. 😉