Skip to content

Commit

Permalink
Example of module-level log usage and RUST_LOG usage in main doc (bev…
Browse files Browse the repository at this point in the history
…yengine#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
  • Loading branch information
blaind authored and Ku95 committed Mar 6, 2022
1 parent 8e4bda1 commit d7fbf2b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/bevy_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ 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();
/// }
/// ```
///
/// 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.
///
Expand Down

0 comments on commit d7fbf2b

Please sign in to comment.