Skip to content

Commit 2dcc828

Browse files
committed
use env variable to control thread ids in rustc_log
1 parent 1516ca1 commit 2dcc828

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

compiler/rustc_log/src/lib.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,21 @@ pub fn init_env_logger(env: &str) -> Result<(), Error> {
7474
Some(v) => &v != "0",
7575
};
7676

77+
let verbose_thread_ids = match env::var_os(String::from(env) + "_THREAD_IDS") {
78+
None => false,
79+
Some(v) => &v == "1",
80+
};
81+
7782
let layer = tracing_tree::HierarchicalLayer::default()
7883
.with_writer(io::stderr)
7984
.with_indent_lines(true)
8085
.with_ansi(color_logs)
8186
.with_targets(true)
8287
.with_verbose_exit(verbose_entry_exit)
8388
.with_verbose_entry(verbose_entry_exit)
84-
.with_indent_amount(2);
85-
#[cfg(all(parallel_compiler, debug_assertions))]
86-
let layer = layer.with_thread_ids(true).with_thread_names(true);
89+
.with_indent_amount(2)
90+
.with_thread_ids(verbose_thread_ids)
91+
.with_thread_names(verbose_thread_ids);
8792

8893
let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer);
8994
match env::var(format!("{env}_BACKTRACE")) {

0 commit comments

Comments
 (0)