Skip to content

Commit

Permalink
Web logger: Mute debug log-spam from wgpu crates
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 18, 2024
1 parent d6bdadb commit 6b0c20b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/eframe/src/web/web_logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ impl WebLogger {

impl log::Log for WebLogger {
fn enabled(&self, metadata: &log::Metadata<'_>) -> bool {
/// Never log anything less serious than a `INFO` from these crates.
const CRATES_AT_INFO_LEVEL: &[&str] = &[
// wgpu crates spam a lot on debug level, which is really annoying
"naga",
"wgpu_core",
"wgpu_hal",
];

if CRATES_AT_INFO_LEVEL
.iter()
.any(|crate_name| metadata.target().starts_with(crate_name))
{
return metadata.level() <= log::LevelFilter::Info;
}

metadata.level() <= self.filter
}

Expand Down

0 comments on commit 6b0c20b

Please sign in to comment.