diff --git a/crates/bevy_log/src/lib.rs b/crates/bevy_log/src/lib.rs index 5e630c7f08..4c576a4e6f 100644 --- a/crates/bevy_log/src/lib.rs +++ b/crates/bevy_log/src/lib.rs @@ -101,6 +101,21 @@ pub(crate) struct FlushGuard(SyncCell); /// If you define the `RUST_LOG` environment variable, the [`LogPlugin`] settings /// will be ignored. /// +/// Also, to disable colour terminal output (ANSI escape codes), you can +/// set the environment variable `NO_COLOR` to any value. This common +/// convention is documented at [no-color.org](https://no-color.org/). +/// For example: +/// ```no_run +/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, PluginGroup}; +/// # use bevy_log::LogPlugin; +/// fn main() { +/// std::env::set_var("NO_COLOR", "1"); +/// App::new() +/// .add_plugins(DefaultPlugins) +/// .run(); +/// } +/// ``` +/// /// If you want to setup your own tracing collector, you should disable this /// plugin from `DefaultPlugins`: /// ```no_run @@ -218,6 +233,9 @@ impl Plugin for LogPlugin { #[cfg(feature = "tracing-tracy")] let tracy_layer = tracing_tracy::TracyLayer::default(); + // note: the implementation of `Default` reads from the env var NO_COLOR + // to decide whether to use ANSI color codes, which is common convention + // https://no-color.org/ let fmt_layer = tracing_subscriber::fmt::Layer::default().with_writer(std::io::stderr); // bevy_render::renderer logs a `tracy.frame_mark` event every frame