Conversation
crates/uv-static/src/env_vars.rs
Outdated
| /// Give log messages more detailed context | ||
| pub const UV_LOG_CONTEXT: &'static str = "UV_LOG_CONTEXT"; |
There was a problem hiding this comment.
Curious, why this name? Should it be UV_LOG_TREE and/or UV_LOG_DURATIONS? Are these separable concepts?
There was a problem hiding this comment.
The two modes in the code make several random format changes, and the best I could come up with to describe them all was "more context". This extra granularity seemed a bit excessive?
There was a problem hiding this comment.
I guess while we're touching it I'd rather have extra granularity with clear purpose than a catch-all flag that is mysterious. @konstin may have some thoughts, as he added that initial configuration.
Also cc @MichaReiser as I imagine we'll want a shared experience across the tools long-term.
There was a problem hiding this comment.
The behavior is already different:
- no args: info
-v: info-vv: debug- -vvv`: trace (but Red Knot / Ruff only). Also changes the output format
- Use
KNOT_LOGfor getting non ruff/Red Knot debug information
We also strip trace from release builds.
Regarding the option. I don't have a strong opinion on its name. The main difference to me between the tree/flat layout and how we use it in Red Knot is that the tree layout not only logs messages but also includes the spans (with enter and exit events).
I'd also consider this env var to be outside our versioning policy (unlike UV_LOG) so that we can iterate on naming design. E.g. should it be different env vars to switch between tree/flat but have a different env var that enables span logging for the flat layout? Or does the env var use some form of DSL?
There was a problem hiding this comment.
My overall ideal for the log levels is:
- Default: You get information about your project only, concisely, so you can actually follow it.
-v: You get information about uv and what actions it performs, e.g. uv version, current platform, steps such as lock/sync/install. This information is understandable after read the docs, you could turn this on e.g. by default on CI.-vv(orRUST_LOG=uv=debug): You get debug messages. These are detailed information that expose some internals from uv, but usually written in a way that users can understand. It's the "user serviceable" level. You would runuv ... -vv ...and share the gist when creating a bug reportRUST_LOG=...=traceyou want to get detailed, very verbose output for a specific area of uv. Requires understanding the uv codebase to interpret, targeted at developers.
I like the proposed changes in shifting us towards that, though I'd skip on exposing RUST_LOG=trace to the CLI, some non-uv crates tend to get really noisy at that level and we've barely ever needed that information.
There was a problem hiding this comment.
This makes sense. I think you wrote the wrong thing in the initial post.
Oh right
Do you have opinions on how that's done or named? i.e., comments on my suggestions at the top?
Not really beyond what I mentioned in my original reply. But @sharkdp has worked with it more than I did, maybe he has some more thoughts?
There was a problem hiding this comment.
Not sure I understand the full picture here. I found the tree-like output very useful when working on red knot, mostly because type inference is a deeply recursive and it's often useful to see the full call stack. I'm not sure if I would find it equally useful in other code bases, but I don't really mind the auto-change in format when going from -vv to -vvv. I never felt the need to see tracing logs without the tree-like format. So I guess I would recommend to go with just one "control parameter" first, and add a second later, if needed?
There was a problem hiding this comment.
I look at the tracing logs a lot and never in the tree format — but that's because -vvv doesn't enable tracing here 🤷♀️. I don't have strong feelings here. It's easy to iterate on this (the formatting) too so we should bias towards just merging something.
There was a problem hiding this comment.
I think Konsti has a fair point about -vvv, but I don't know what else we'd do with that level until we have a proper info layer and it seems fine to just have it be extremely verbose unless we start getting lots of user reports with too much logs. Since most users don't even share output with -v, I'm not too worried.
There was a problem hiding this comment.
Personally, I've never used the tree output, I think @charliermarsh found it helpful?
crates/uv-static/src/env_vars.rs
Outdated
| /// for more. | ||
| pub const RUST_LOG: &'static str = "RUST_LOG"; | ||
|
|
||
| /// Give log messages more detailed context |
There was a problem hiding this comment.
| /// Give log messages more detailed context | |
| /// Add additional context and structure to log messages. | |
| /// If logging is not enabled, e.g., with `RUST_LOG` or `-v`, this has no effect. |
| } else { | ||
| // Regardless of the tracing level, show messages without any adornment. | ||
| let format = UvFormat { | ||
| display_timestamp: false, |
There was a problem hiding this comment.
Sometimes, I sometimes find timestamps very helpful (it's direct performance information), but it's probably not worth adding a flag for it.
Reworks how log verbosity flags work. * `<no argument>` is the same, equivalent to `RUST_LOG=off` * `-v` is the same, equivalent to `RUST_LOG=uv=debug` * `-vv` is now equivalent to `RUST_LOG=uv=trace` (previously it only enabled more log message context) * `-vvv` is now equivalent to `RUST_LOG=trace` (previously it was equivalent to `-vv`) The "more context" that `-vv` had has been moved to an orthogonal setting via an environment variable. Setting `UV_LOG_CONTEXT=1` will add the extra context that `-vv` did. In the future we may make these more granular as we try to use `info!/warn!` more. Fixes astral-sh#1569
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.6.3` -> `0.6.4` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>astral-sh/uv (astral-sh/uv)</summary> ### [`v0.6.4`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#064) [Compare Source](astral-sh/uv@0.6.3...0.6.4) ##### Enhancements - Upgrade pypy3.10 to v7.3.19 ([#​11814](astral-sh/uv#11814)) - Allow configuring log verbosity from the CLI (i.e., `-vvv`) ([#​11758](astral-sh/uv#11758)) - Warn when duplicate index names found in single file ([#​11824](astral-sh/uv#11824)) ##### Bug fixes - Always store registry index on resolution packages ([#​11815](astral-sh/uv#11815)) - Avoid error on relative paths in `uv tool uninstall` ([#​11889](astral-sh/uv#11889)) - Avoid silently dropping errors in directory enumeration ([#​11890](astral-sh/uv#11890)) - Disable interactive git terminal prompts during fetches ([#​11744](astral-sh/uv#11744)) - Discover Windows registry (PEP 514) Python versions across 32/64-bit ([#​11801](astral-sh/uv#11801)) - Don't panic on Ctrl-C in confirm prompt ([#​11706](astral-sh/uv#11706)) - Fix non-directory in workspace on Windows ([#​11833](astral-sh/uv#11833)) - Make interpreter caching robust to OS upgrades ([#​11875](astral-sh/uv#11875)) - Respect `include-system-site-packages` in layered environments ([#​11873](astral-sh/uv#11873)) - Suggest `uv tool update-shell` in PowerShell ([#​11846](astral-sh/uv#11846)) - Update code page to `65001` before setting environment variables in virtual environments ([#​11831](astral-sh/uv#11831)) - Use hash instead of full wheel name in wheels bucket ([#​11738](astral-sh/uv#11738)) - Fix version string truncation while generating cache_key ([#​11830](astral-sh/uv#11830)) - Explicitly handle ctrl-c in confirmation prompt instead of using a signal handler ([#​11897](astral-sh/uv#11897)) ##### Performance - Avoid cloning to string when creating cache path ([#​11772](astral-sh/uv#11772)) - Avoid redundant clones in version containment check ([#​11767](astral-sh/uv#11767)) - Avoid string allocation when enumerating tool names ([#​11910](astral-sh/uv#11910)) - Avoid using owned `String` for package name constructors ([#​11768](astral-sh/uv#11768)) - Avoid using owned `String` in deserializers ([#​11764](astral-sh/uv#11764)) - Migrate to `zlib-rs` (again) ([#​11894](astral-sh/uv#11894)) - Remove unnecessary clones when adding package names ([#​11771](astral-sh/uv#11771)) - Skip unquote allocation for non-quoted strings ([#​11813](astral-sh/uv#11813)) - Use `SmallString` for filenames and URLs ([#​11765](astral-sh/uv#11765)) - Use a Boxed slice for version specifiers ([#​11766](astral-sh/uv#11766)) - Use matches over contains for extra value parsing ([#​11770](astral-sh/uv#11770)) ##### Documentation - Avoid fallback to PyPI in mixed CPU/CUDA example ([#​11115](astral-sh/uv#11115)) - Docs: Clarify that setting cache-keys overrides defaults ([#​11895](astral-sh/uv#11895)) - Document our MSRV policy ([#​11898](astral-sh/uv#11898)) - Fix reference to macOS cache path ([#​11845](astral-sh/uv#11845)) - Fix typo in `no_default_groups` documentation and changelog ([#​11928](astral-sh/uv#11928)) - Update the "Locking and syncing" page ([#​11647](astral-sh/uv#11647)) - Update alternative indexes documentation to use new interface ([#​10826](astral-sh/uv#10826)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODUuMCIsInVwZGF0ZWRJblZlciI6IjM5LjE4NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Reworks how log verbosity flags work.
<no argument>is the same, equivalent toRUST_LOG=off-vis the same, equivalent toRUST_LOG=uv=debug-vvis now equivalent toRUST_LOG=uv=trace(previously it only enabled more log message context)-vvvis now equivalent toRUST_LOG=trace(previously it was equivalent to-vv)The "more context" that
-vvhad has been moved to an orthogonal setting via an environment variable. SettingUV_LOG_CONTEXT=1will add the extra context that-vvdid.In the future we may make these more granular as we try to use
info!/warn!more.Fixes #1569