Skip to content

Commit 70a2345

Browse files
committed
fix(log): use RUSTUP_LOG for internal tracing instead of RUST_LOG
1 parent 01d58b5 commit 70a2345

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

doc/user-guide/src/environment-variables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Environment variables
22

3-
- `RUST_LOG` (default: none). Enables Rustup's "custom logging mode". In this mode,
3+
- `RUSTUP_LOG` (default: none). Enables Rustup's "custom logging mode". In this mode,
44
the verbosity of Rustup's log lines can be specified with `tracing_subscriber`'s
5-
[directive syntax]. For example, set `RUST_LOG=rustup=DEBUG` to receive log lines
5+
[directive syntax]. For example, set `RUSTUP_LOG=rustup=DEBUG` to receive log lines
66
from `rustup` itself with a maximal verbosity of `DEBUG`.
77

88
- `RUSTUP_HOME` (default: `~/.rustup` or `%USERPROFILE%/.rustup`). Sets the

src/cli/log.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn tracing_subscriber(process: &Process) -> impl tracing::Subscriber {
5757
/// A [`tracing::Subscriber`] [`Layer`][`tracing_subscriber::Layer`] that prints out the log
5858
/// lines to the current [`Process`]' `stderr`.
5959
///
60-
/// When the `RUST_LOG` environment variable is present, a standard [`tracing_subscriber`]
60+
/// When the `RUSTUP_LOG` environment variable is present, a standard [`tracing_subscriber`]
6161
/// formatter will be used according to the filtering directives set in its value.
6262
/// Otherwise, this logger will use [`EventFormatter`] to mimic "classic" Rustup `stderr` output.
6363
fn console_logger<S>(process: &Process) -> impl Layer<S>
@@ -71,12 +71,12 @@ where
7171
_ if process.var("NO_COLOR").is_ok() => false,
7272
_ => process.stderr().is_a_tty(process),
7373
};
74-
let maybe_rust_log_directives = process.var("RUST_LOG");
74+
let maybe_rustup_log_directives = process.var("RUSTUP_LOG");
7575
let process = process.clone();
7676
let logger = tracing_subscriber::fmt::layer()
7777
.with_writer(move || process.stderr())
7878
.with_ansi(has_ansi);
79-
if let Ok(directives) = maybe_rust_log_directives {
79+
if let Ok(directives) = maybe_rustup_log_directives {
8080
let env_filter = EnvFilter::builder()
8181
.with_default_directive(LevelFilter::INFO.into())
8282
.parse_lossy(directives);
@@ -143,7 +143,7 @@ fn telemetry<S>(process: &Process) -> impl Layer<S>
143143
where
144144
S: Subscriber + for<'span> LookupSpan<'span>,
145145
{
146-
let env_filter = if let Ok(directives) = process.var("RUST_LOG") {
146+
let env_filter = if let Ok(directives) = process.var("RUSTUP_LOG") {
147147
EnvFilter::builder()
148148
.with_default_directive(LevelFilter::TRACE.into())
149149
.parse_lossy(directives)

0 commit comments

Comments
 (0)