diff options
author | Ralf Jung <post@ralfj.de> | 2022-05-11 09:14:31 +0200 |
---|---|---|
committer | Ralf Jung <post@ralfj.de> | 2022-05-11 09:14:31 +0200 |
commit | 831bd969674fd8afa751b13db543d58b2176c98c (patch) | |
tree | d6a80505b62accf8a338b3a47d819db222583171 /compiler/rustc_log | |
parent | d53f1e8fbf891cf84fcb11eb078a27e528df795a (diff) | |
download | rust-831bd969674fd8afa751b13db543d58b2176c98c.tar.gz |
rustc_log: add env var to set verbose entry/exit behavior
Diffstat (limited to 'compiler/rustc_log')
-rw-r--r-- | compiler/rustc_log/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_log/src/lib.rs b/compiler/rustc_log/src/lib.rs index f5e7435d36e..c152815eeca 100644 --- a/compiler/rustc_log/src/lib.rs +++ b/compiler/rustc_log/src/lib.rs @@ -67,11 +67,24 @@ pub fn init_env_logger(env: &str) -> Result<(), Error> { Err(VarError::NotUnicode(_value)) => return Err(Error::NonUnicodeColorValue), }; + let verbose_entry_exit = match env::var_os(String::from(env) + "_ENTRY_EXIT") { + None => false, + Some(v) => { + if &v == "0" { + false + } else { + true + } + } + }; + let layer = tracing_tree::HierarchicalLayer::default() .with_writer(io::stderr) .with_indent_lines(true) .with_ansi(color_logs) .with_targets(true) + .with_verbose_exit(verbose_entry_exit) + .with_verbose_entry(verbose_entry_exit) .with_indent_amount(2); #[cfg(parallel_compiler)] let layer = layer.with_thread_ids(true).with_thread_names(true); |