Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable trace level tracing by default via a Cargo feature #7223

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,22 @@ default = [
"animation",
"bevy_asset",
"bevy_audio",
"bevy_gilrs",
"bevy_scene",
"bevy_winit",
"bevy_core_pipeline",
"bevy_pbr",
"bevy_gilrs",
"bevy_gltf",
"bevy_pbr",
"bevy_render",
"bevy_scene",
"bevy_sprite",
"bevy_text",
"bevy_ui",
"png",
"bevy_winit",
"filesystem_watcher",
"hdr",
"png",
"release_max_level_debug",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is the real change, the rest was just alpha-sorting the list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that not just called trace or tracing and left out of default features? Negative features are strongly discouraged by cargo itself; all features should be additive.

"vorbis",
"x11",
"filesystem_watcher",
]

# Force dynamic linking, which improves iterative compile times
Expand Down Expand Up @@ -119,6 +120,11 @@ debug_asset_server = ["bevy_internal/debug_asset_server"]
# Enable animation support, and glTF animation loading
animation = ["bevy_internal/animation"]

# Statically disables trace level at compile time.
# The overhead of checking of even checking that trace level is enabled at runtime
# can be significant in tight inner loops.
release_max_level_debug = ["bevy_internal/release_max_level_debug"]

[dependencies]
bevy_dylib = { path = "crates/bevy_dylib", version = "0.9.0", default-features = false, optional = true }
bevy_internal = { path = "crates/bevy_internal", version = "0.9.0", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ trace_chrome = [ "bevy_log/tracing-chrome" ]
trace_tracy = ["bevy_render?/tracing-tracy", "bevy_log/tracing-tracy" ]
wgpu_trace = ["bevy_render/wgpu_trace"]
debug_asset_server = ["bevy_asset/debug_asset_server"]
release_max_level_debug = ["bevy_utils/release_max_level_debug"]

# Image format support for texture loading (PNG and HDR are enabled by default)
hdr = ["bevy_render/hdr"]
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter};
///
/// Log level can also be changed using the `RUST_LOG` environment variable.
/// For example, using `RUST_LOG=wgpu=error,bevy_render=info,bevy_ecs=trace cargo run ..`
/// Note that the default Bevy Cargo feature `release_max_level_debug` will statically
/// disable trace level logging to reduce overhead in release mode.
///
/// It has the same syntax as the field [`LogPlugin::filter`], see [`EnvFilter`].
/// If you define the `RUST_LOG` environment variable, the [`LogPlugin`] settings
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ repository = "https://github.com/bevyengine/bevy"
license = "MIT OR Apache-2.0"
keywords = ["bevy"]

[features]
release_max_level_debug = ["tracing/release_max_level_debug"]

[dependencies]
ahash = "0.7.0"
tracing = { version = "0.1", default-features = false, features = ["std"] }
Expand Down