Skip to content

Commit fc0e7f1

Browse files
committed
feat(cli/setup-mode)!: set log level to DEBUG on --verbose if RUSTUP_LOG is unset
1 parent d4e4b7f commit fc0e7f1

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

rustup-init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Usage: rustup-init[EXE] [OPTIONS]
4141
4242
Options:
4343
-v, --verbose
44-
Enable verbose output
44+
Enable verbose output, limit console logger level to 'DEBUG' if 'RUSTUP_LOG' is unset
4545
-q, --quiet
4646
Disable progress output, limit console logger level to 'WARN' if 'RUSTUP_LOG' is unset
4747
-y

src/cli/setup_mode.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ use crate::{
2525
before_help = format!("rustup-init {}", common::version()),
2626
)]
2727
struct RustupInit {
28-
/// Enable verbose output
29-
#[arg(short, long)]
28+
/// Enable verbose output, limit console logger level to 'DEBUG' if 'RUSTUP_LOG' is unset
29+
#[arg(short, long, overrides_with = "quiet")]
3030
verbose: bool,
3131

3232
/// Disable progress output, limit console logger level to 'WARN' if 'RUSTUP_LOG' is unset
33-
#[arg(short, long)]
33+
#[arg(short, long, overrides_with = "verbose")]
3434
quiet: bool,
3535

3636
/// Disable confirmation prompt
@@ -115,10 +115,17 @@ pub async fn main(
115115
warn!("{}", common::WARN_COMPLETE_PROFILE);
116116
}
117117

118-
if quiet && process.var("RUSTUP_LOG").is_err() {
119-
console_filter
120-
.modify(|it| *it = EnvFilter::new("rustup=WARN"))
121-
.expect("error reloading `EnvFilter` for console_logger");
118+
if process.var("RUSTUP_LOG").is_err() {
119+
if quiet {
120+
console_filter
121+
.modify(|it| *it = EnvFilter::new("rustup=WARN"))
122+
.expect("error reloading `EnvFilter` for console_logger");
123+
}
124+
if verbose {
125+
console_filter
126+
.modify(|it| *it = EnvFilter::new("rustup=DEBUG"))
127+
.expect("error reloading `EnvFilter` for console_logger");
128+
}
122129
}
123130

124131
let opts = InstallOpts {

tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Usage: rustup-init[EXE] [OPTIONS]
1010
1111
Options:
1212
-v, --verbose
13-
Enable verbose output
13+
Enable verbose output, limit console logger level to 'DEBUG' if 'RUSTUP_LOG' is unset
1414
-q, --quiet
1515
Disable progress output, limit console logger level to 'WARN' if 'RUSTUP_LOG' is unset
1616
-y

tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Usage: rustup-init[EXE] [OPTIONS]
1010
1111
Options:
1212
-v, --verbose
13-
Enable verbose output
13+
Enable verbose output, limit console logger level to 'DEBUG' if 'RUSTUP_LOG' is unset
1414
-q, --quiet
1515
Disable progress output, limit console logger level to 'WARN' if 'RUSTUP_LOG' is unset
1616
-y

0 commit comments

Comments
 (0)