Skip to content

Make link logging more consistent #7390

@xavfernandez

Description

@xavfernandez

What's the problem this feature will solve?

Links are sometimes logged via their __str__ method (cf

"HTTP error %s while getting %s", exc.response.status_code, link,
), sometimes with custom logic like in
if link.netloc == PyPI.file_storage_domain:
url = link.show_url
else:
url = link.url_without_fragment
redacted_url = redact_auth_from_url(url)

And on top of that we have a special case for PyPI downloads.

Like Chris pointed out in #7384 (comment) this special case (reintroduced via #7225) doesn't help with debugging.

Describe the solution you'd like

Always use the same logic (a Link property (or __str__) when logging a link, ideally with identical logic when dealing wih filepath or VCS urls.

This could involve always using link.show_url for info logs and provide the full (redacted) url in --verbose mode.

Alternative Solutions

Statu quo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions