We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
console_logger()
RUSTUP_TERM_COLOR
NO_COLOR
1 parent ce51d7d commit f8159feCopy full SHA for f8159fe
src/cli/log.rs
@@ -65,7 +65,16 @@ where
65
S: Subscriber + for<'span> LookupSpan<'span>,
66
{
67
let maybe_rust_log_directives = process.var_os("RUST_LOG").clone();
68
- let has_ansi = process.stderr().is_a_tty();
+ let has_ansi = {
69
+ let env_override = process.var("RUSTUP_TERM_COLOR").map(|it| it.to_lowercase());
70
+ match env_override.as_deref() {
71
+ Ok("always") => true,
72
+ Ok("never") => false,
73
+ // `RUSTUP_TERM_COLOR` is prioritized over `NO_COLOR`.
74
+ _ if process.var("NO_COLOR").is_ok() => false,
75
+ _ => process.stderr().is_a_tty(),
76
+ }
77
+ };
78
let logger = tracing_subscriber::fmt::layer()
79
.with_writer(move || process.stderr())
80
.with_ansi(has_ansi);
0 commit comments