From 72bb38cad5dcd69c898e4d95bd360e849ba7c92e Mon Sep 17 00:00:00 2001 From: Mika Date: Sat, 5 Mar 2022 03:00:31 +0000 Subject: [PATCH] Example of module-level log usage and RUST_LOG usage in main doc (#3919) # Objective When developing plugins, I very often come up to the need to have logging information printed out. The exact syntax is a bit cryptic, and takes some time to find the documentation. Also a minor typo fix in `It has the same syntax as` part ## Solution Adding a direct example in the module level information for both: 1. Enabling a specific level (`trace` in the example) for a module and all its subsystems at App init 2. Doing the same from console, when launching the application --- crates/bevy_log/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/bevy_log/src/lib.rs b/crates/bevy_log/src/lib.rs index 7c7f07f36d..a6c6294af2 100644 --- a/crates/bevy_log/src/lib.rs +++ b/crates/bevy_log/src/lib.rs @@ -55,7 +55,7 @@ use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter}; /// App::new() /// .insert_resource(LogSettings { /// level: Level::DEBUG, -/// filter: "wgpu=error,bevy_render=info".to_string(), +/// filter: "wgpu=error,bevy_render=info,bevy_ecs=trace".to_string(), /// }) /// .add_plugins(DefaultPlugins) /// .run(); @@ -63,7 +63,9 @@ use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter}; /// ``` /// /// Log level can also be changed using the `RUST_LOG` environment variable. -/// It has the same syntax has the field [`LogSettings::filter`], see [`EnvFilter`]. +/// For example, using `RUST_LOG=wgpu=error,bevy_render=info,bevy_ecs=trace cargo run ..` +/// +/// It has the same syntax as the field [`LogSettings::filter`], see [`EnvFilter`]. /// If you define the `RUST_LOG` environment variable, the [`LogSettings`] resource /// will be ignored. ///