diff options
| author | bors <bors@rust-lang.org> | 2024-03-03 14:01:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-03 14:01:47 +0000 |
| commit | 26907374b9478d84d766aea85b10b51af8dbcce8 (patch) | |
| tree | be19b487d32e4a2a022f3bde10e3b36aa61e1630 /compiler/rustc_log/src | |
| parent | 9e73597e5a83e96e223c10b3810566c74a86a0c1 (diff) | |
| parent | e634a0a51b088bd8df4e07d2f2666daabb01e338 (diff) | |
| download | rust-26907374b9478d84d766aea85b10b51af8dbcce8.tar.gz rust-26907374b9478d84d766aea85b10b51af8dbcce8.zip | |
Auto merge of #121937 - GuillaumeGomez:rollup-9684vg3, r=GuillaumeGomez
Rollup of 3 pull requests Successful merges: - #121917 (Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching) - #121933 (Add missing get_name for wasm::thread.) - #121934 (rustc_log: expose tracing-tree "wraparound" in an env var) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_log/src')
| -rw-r--r-- | compiler/rustc_log/src/lib.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/compiler/rustc_log/src/lib.rs b/compiler/rustc_log/src/lib.rs index 1a78f9f0f86..e4b67cde244 100644 --- a/compiler/rustc_log/src/lib.rs +++ b/compiler/rustc_log/src/lib.rs @@ -57,6 +57,7 @@ pub struct LoggerConfig { pub verbose_entry_exit: Result<String, VarError>, pub verbose_thread_ids: Result<String, VarError>, pub backtrace: Result<String, VarError>, + pub wraptree: Result<String, VarError>, } impl LoggerConfig { @@ -67,6 +68,7 @@ impl LoggerConfig { verbose_entry_exit: env::var(format!("{env}_ENTRY_EXIT")), verbose_thread_ids: env::var(format!("{env}_THREAD_IDS")), backtrace: env::var(format!("{env}_BACKTRACE")), + wraptree: env::var(format!("{env}_WRAPTREE")), } } } @@ -99,7 +101,7 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> { Err(_) => false, }; - let layer = tracing_tree::HierarchicalLayer::default() + let mut layer = tracing_tree::HierarchicalLayer::default() .with_writer(io::stderr) .with_indent_lines(true) .with_ansi(color_logs) @@ -110,6 +112,16 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> { .with_thread_ids(verbose_thread_ids) .with_thread_names(verbose_thread_ids); + match cfg.wraptree { + Ok(v) => match v.parse::<usize>() { + Ok(v) => { + layer = layer.with_wraparound(v); + } + Err(_) => return Err(Error::InvalidWraptree(v)), + }, + Err(_) => {} // no wraptree + } + let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer); match cfg.backtrace { Ok(str) => { @@ -164,6 +176,7 @@ pub fn stderr_isatty() -> bool { pub enum Error { InvalidColorValue(String), NonUnicodeColorValue, + InvalidWraptree(String), } impl std::error::Error for Error {} @@ -179,6 +192,10 @@ impl Display for Error { formatter, "non-Unicode log color value: expected one of always, never, or auto", ), + Error::InvalidWraptree(value) => write!( + formatter, + "invalid log WRAPTREE value '{value}': expected a non-negative integer", + ), } } } |
