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
This commit is contained in:
Mika 2022-03-05 03:00:31 +00:00
parent b6a647cc01
commit 72bb38cad5

View file

@ -55,7 +55,7 @@ use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter};
/// App::new() /// App::new()
/// .insert_resource(LogSettings { /// .insert_resource(LogSettings {
/// level: Level::DEBUG, /// 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) /// .add_plugins(DefaultPlugins)
/// .run(); /// .run();
@ -63,7 +63,9 @@ use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter};
/// ``` /// ```
/// ///
/// Log level can also be changed using the `RUST_LOG` environment variable. /// 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 /// If you define the `RUST_LOG` environment variable, the [`LogSettings`] resource
/// will be ignored. /// will be ignored.
/// ///