Bump tracing-tree and allow rendering lines again

This commit is contained in:
Oli Scherer 2024-06-11 08:55:48 +00:00
parent 76c73827dc
commit 185a48d4b2
2 changed files with 9 additions and 1 deletions

View file

@ -8,7 +8,7 @@ edition = "2021"
tracing = "0.1.28"
tracing-core = "=0.1.30" # FIXME(Nilstrieb) tracing has a deadlock: https://github.com/tokio-rs/tracing/issues/2635
tracing-subscriber = { version = "0.3.3", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] }
tracing-tree = "0.3.0"
tracing-tree = "0.3.1"
# tidy-alphabetical-end
[dev-dependencies]

View file

@ -58,6 +58,7 @@ pub struct LoggerConfig {
pub verbose_thread_ids: Result<String, VarError>,
pub backtrace: Result<String, VarError>,
pub wraptree: Result<String, VarError>,
pub lines: Result<String, VarError>,
}
impl LoggerConfig {
@ -69,6 +70,7 @@ pub fn from_env(env: &str) -> Self {
verbose_thread_ids: env::var(format!("{env}_THREAD_IDS")),
backtrace: env::var(format!("{env}_BACKTRACE")),
wraptree: env::var(format!("{env}_WRAPTREE")),
lines: env::var(format!("{env}_LINES")),
}
}
}
@ -101,6 +103,11 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> {
Err(_) => false,
};
let lines = match cfg.lines {
Ok(v) => &v == "1",
Err(_) => false,
};
let mut layer = tracing_tree::HierarchicalLayer::default()
.with_writer(io::stderr)
.with_ansi(color_logs)
@ -108,6 +115,7 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> {
.with_verbose_exit(verbose_entry_exit)
.with_verbose_entry(verbose_entry_exit)
.with_indent_amount(2)
.with_indent_lines(lines)
.with_thread_ids(verbose_thread_ids)
.with_thread_names(verbose_thread_ids);