From e600e2c1b14b520af65b6c32d5897724ba9aa8fb Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 29 Aug 2024 05:15:49 -0700 Subject: [PATCH] Move the default LogPlugin filter to a public constant (#14958) # Objective This moves the default `LogPlugin` filter to be a public constant so that it can be updated and referenced from outside code without changes across releases: ``` fn main() { App::new().add_plugins( DefaultPlugins .set(bevy::log::LogPlugin { filter: format!("{},mylogs=error", bevy::log::LogPlugin::DEFAULT_FILTER), ..default() })).run(); } ``` ## Testing Tested with `cargo run -p ci` --- crates/bevy_log/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/bevy_log/src/lib.rs b/crates/bevy_log/src/lib.rs index c2fdd1639b..53f1dbd6d1 100644 --- a/crates/bevy_log/src/lib.rs +++ b/crates/bevy_log/src/lib.rs @@ -157,10 +157,13 @@ pub struct LogPlugin { /// A boxed [`Layer`] that can be used with [`LogPlugin`]. pub type BoxedLayer = Box + Send + Sync + 'static>; +/// The default [`LogPlugin`] [`EnvFilter`]. +pub const DEFAULT_FILTER: &str = "wgpu=error,naga=warn"; + impl Default for LogPlugin { fn default() -> Self { Self { - filter: "wgpu=error,naga=warn".to_string(), + filter: DEFAULT_FILTER.to_string(), level: Level::INFO, custom_layer: |_| None, }