-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Bevy_utils should not force tracing's release_max_level_info crate feature #4069
Comments
Seems like a sensible change. Want to make a PR? |
@alice-i-cecile Sure, I'll try to take a stab at the required code changes this weekend. Would you consider the documentation additions to be required in order to merge the change? |
Bevy is quite opinionated on how it sets up logs, and its good that it adds that feature by default... It would be better if it was possible to disable it though |
Generally yes, although I'll need to examine the PR in detail (I'm not super familiar with that area of the code). |
Totally in agreement there - as a default it's a fine stance to take, but the difficulty is that |
I've also run into this, right now I'm using
Being opinionated in design is one thing, this however just forces the user into an optimization step that affects a lot more than Bevy itself, cannot be opted-out from, and could be achieved by the user easily as well if desired. The
In #1206 it was suggested that feature flags from I believe the best way forward for this would be simply removing the constraint and adding an entry about it in a performance/release-oriented section of the documentation. Alternatively if this feature flag is really desired, it could be moved up from |
# Objective - Debug logs are useful in release builds, but `tracing` logs are hard-capped (`release_max_level_info`) at the `info` level by `bevy_utils`. ## Solution - This PR simply removes the limit in `bevy_utils` with no further actions. - If any out-of-the box performance regressions arise, the steps to enable this `tracing` feature should be documented in a user guide in the future. This PR closes #4069 and closes #1206. ## Alternatives considered - Instruct the user to build with `debug-assertions` enabled: this is just a workaround, as it obviously enables all `debug-assertions` that affect more than logging itself. - Re-exporting the feature from `tracing` and enabling it by default: I believe it just adds complexity and confusion, the `tracing` feature can also be re-enabled with one line in userland. --- ## Changelog ### Fixed - Log level is not hard capped at `info` for release builds anymore. ## Migration Guide - Maximum log levels for release builds is not enforced by Bevy anymore, to omit "debug" and "trace" level logs entirely from release builds, `tracing` must be added as a dependency with its `release_max_level_info` feature enabled in `Cargo.toml`. (`tracing = { version = "0.1", features = ["release_max_level_info"] }`)
# Objective - Debug logs are useful in release builds, but `tracing` logs are hard-capped (`release_max_level_info`) at the `info` level by `bevy_utils`. ## Solution - This PR simply removes the limit in `bevy_utils` with no further actions. - If any out-of-the box performance regressions arise, the steps to enable this `tracing` feature should be documented in a user guide in the future. This PR closes bevyengine#4069 and closes bevyengine#1206. ## Alternatives considered - Instruct the user to build with `debug-assertions` enabled: this is just a workaround, as it obviously enables all `debug-assertions` that affect more than logging itself. - Re-exporting the feature from `tracing` and enabling it by default: I believe it just adds complexity and confusion, the `tracing` feature can also be re-enabled with one line in userland. --- ## Changelog ### Fixed - Log level is not hard capped at `info` for release builds anymore. ## Migration Guide - Maximum log levels for release builds is not enforced by Bevy anymore, to omit "debug" and "trace" level logs entirely from release builds, `tracing` must be added as a dependency with its `release_max_level_info` feature enabled in `Cargo.toml`. (`tracing = { version = "0.1", features = ["release_max_level_info"] }`)
# Objective - Debug logs are useful in release builds, but `tracing` logs are hard-capped (`release_max_level_info`) at the `info` level by `bevy_utils`. ## Solution - This PR simply removes the limit in `bevy_utils` with no further actions. - If any out-of-the box performance regressions arise, the steps to enable this `tracing` feature should be documented in a user guide in the future. This PR closes bevyengine#4069 and closes bevyengine#1206. ## Alternatives considered - Instruct the user to build with `debug-assertions` enabled: this is just a workaround, as it obviously enables all `debug-assertions` that affect more than logging itself. - Re-exporting the feature from `tracing` and enabling it by default: I believe it just adds complexity and confusion, the `tracing` feature can also be re-enabled with one line in userland. --- ## Changelog ### Fixed - Log level is not hard capped at `info` for release builds anymore. ## Migration Guide - Maximum log levels for release builds is not enforced by Bevy anymore, to omit "debug" and "trace" level logs entirely from release builds, `tracing` must be added as a dependency with its `release_max_level_info` feature enabled in `Cargo.toml`. (`tracing = { version = "0.1", features = ["release_max_level_info"] }`)
Bevy version
0.6.1 and current main
Operating system & version
Applicable to all
What you did
Include a direct/transitive dependency on
bevy_utils
, which is a dependency of mostbevy_*
internal crates, some of which are a literal or de facto required dependency of the top-levelbevy
crate.What you expected to happen
I should be able to include my preferred level of compile-time verbosity features on the
tracing
crate, including something more verbose thanrelease_max_level_info
or no limit at all.What actually happened
I am forced to use the
release_max_info
crate feature ontracing
which sets a limit on how much verbosity I can produce in release binaries, as tracing calls and attribute macros that are lower verbosity (debug
ortrace
in this example) are fully compiled away prior to runtime.Additional information
As a workaround, I would need to either fork-and-patch
bevy_utils
, or produce a Cargo profile that mimics release profile but will not receive the effects of thistracing
crate flag, which currently requires re-enablingdebug_assertions
. If the linked line could be converted to an on-by-default crate feature ofbevy_utils
that was not also rigidly enforced anywhere else in the bevy crate tree, I think I could continue to use upstream code but get the verbosity I situationally desire.Obviously this is not a common scenario and the performance overhead of each verbosity level is observable, but I think encouraging via documentation and defaults would be preferable to choosing inflexibly for your downstream users.
The text was updated successfully, but these errors were encountered: