Skip to content
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

Use -v, -vv, -vvv to configure tracing levels #1569

Open
zanieb opened this issue Feb 17, 2024 · 7 comments · May be fixed by #11758
Open

Use -v, -vv, -vvv to configure tracing levels #1569

zanieb opened this issue Feb 17, 2024 · 7 comments · May be fixed by #11758
Labels
enhancement New feature or improvement to existing functionality help wanted Contribution especially encouraged tracing Verbose output and debugging

Comments

@zanieb
Copy link
Member

zanieb commented Feb 17, 2024

Right now, as mentioned in #1567, we show a lot of output in -v.

We should have -v be more user friendly and use -vv and -vvv to dump more verbose tracing information.

@zanieb zanieb added enhancement New feature or improvement to existing functionality tracing Verbose output and debugging labels Feb 17, 2024
@olivierlefloch
Copy link
Contributor

I may be missing something, but related to this, it would be great if the -vvv level also displayed calls to trace, for example to debug

#1458

I'd like to be able to see the method that fresh_request invoked. I'm not familiar enough with ruff's tracing/logging, but perhaps

trace!("Sending fresh {} request for {}", req.method(), req.url());

could be logged?

@zanieb
Copy link
Member Author

zanieb commented Feb 18, 2024

You can control the log level during verbose mode with e.g. RUST_LOG=trace for now.

I totally agree though.

@olivierlefloch
Copy link
Contributor

Thanks for the tip! Actually, that failed when running uv with RUST_LOG=trace python -m uv … but worked with RUST_LOG=trace uv … 👍

I'd suggest adding it to CONTRIBUTING.md as that's where I imagined I might be able to find this information: #1670

zanieb pushed a commit that referenced this issue Feb 19, 2024
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

This improves Contributing documentation to specifically mention `trace`
level logging can be obtained via `RUST_LOG=trace uv …` as mentioned
here:
#1569 (comment)

## Test Plan

Compare the output of

```
uv pip install --verbose requests
```

and

```
RUST_LOG=trace uv pip install --verbose requests
```
@zanieb
Copy link
Member Author

zanieb commented Feb 19, 2024

The python -m ... issue should be fixed by #1667

@Gankra
Copy link
Contributor

Gankra commented Feb 24, 2025

Ok so, for context, the tracing log filter levels are:

none < error < warn < info < debug < trace

Currently:

  • <no flag> => none
  • -v => uv=debug (enable debug logs, but only from uv crates, e.g. not reqwest)
  • -vv is just more formatting/details on uv=debug?
  • RUST_LOG="..." is available to override these more fine-grain

In our code, we use warn, debug, and trace.
We basically don't use error and info at all.

Not using error is basically fine, but we want to expand our use of info (migrating some existing debugs/traces to higher log levels).

Naively/greenfield I would want to do -v => error, -vv => warn, etc. But I don't think that's worthwhile.

I think -v => info, -vv = debug, -vvv => trace would be reasonable.

I think starting at -v => warn might be reasonable though?

Unclear if we still want the filter to only be "uv" (I guess sure?).

Unclear if we want this "extra formatting" mode to still be a thing (I'm ambivalent).

@zanieb
Copy link
Member Author

zanieb commented Feb 24, 2025

I think -v => info etc. makes sense in the long run, but I think we need to start with:

-v => debug (uv-only), -vv => trace (uv-only), -vvv => trace (all crates)

We have a lot of work to do before there's a proper info layer and I'm not sure we should block this work on accomplishing that. -v needs to continue to get us logs that are usable for resolving issue reports.

Once we elevate more logs to info, we can shift it all over one?

Regarding the nested formatting, I'd move that to an environment variable. It feels weird in -v (to me).

@Gankra
Copy link
Contributor

Gankra commented Feb 24, 2025

Sounds good to me!

@Gankra Gankra linked a pull request Feb 24, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality help wanted Contribution especially encouraged tracing Verbose output and debugging
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants