From 522692ef50fbf770a37bd896a498065cd28fe040 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 19 Jun 2024 14:09:25 +0200 Subject: [PATCH] linux: Quiet some noisy logs when logging to file (#13260) zbus, naga, and some parts of blade are pretty noisy at the INFO level. zbus especially dumps large debug dumps into the logs. So on Linux, when logging to a file, we reduce that noise. That means one still gets the full firehose when doing `RUST_LOG=info cargo run`, but not in the logs. Release Notes: - N/A --- crates/zed/src/main.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index ac93ed1a1d89ee30f21badccca0a6777521f50ca..d82cc49205b5009eec821424eec7636e910abfb7 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -705,11 +705,19 @@ fn init_logger() { .open(paths::log_file()) { Ok(log_file) => { - let config = ConfigBuilder::new() - .set_time_format_str("%Y-%m-%dT%T%:z") - .set_time_to_local(true) - .build(); + let mut config_builder = ConfigBuilder::new(); + config_builder.set_time_format_str("%Y-%m-%dT%T%:z"); + config_builder.set_time_to_local(true); + + #[cfg(target_os = "linux")] + { + config_builder.add_filter_ignore_str("zbus"); + config_builder.add_filter_ignore_str("blade_graphics::hal::resource"); + config_builder.add_filter_ignore_str("naga::back::spv::writer"); + } + + let config = config_builder.build(); simplelog::WriteLogger::init(level, config, log_file) .expect("could not initialize logger"); }