TheBevyFlock / bevy_new_2d

This template is a great way to get started on a new 2D Bevy game!
https://the-bevy-flock.itch.io/bevy-new-2d
MIT License
186 stars 30 forks source link

Set `log` features on `tracing` as well #199

Closed janhohenheim closed 3 months ago

janhohenheim commented 3 months ago

Per Cargo.toml, we should only see logs for release builds that are at least warn, i.e. only warn and error.

[dependencies.log]
version = "*"
# Disable low-severity logs at compile time for performance.
features = ["max_level_debug", "release_max_level_warn"]

see the relevant documentation: image

However, opening the console in https://the-bevy-flock.itch.io/bevy-quickstart shows that we receive info logs: image

benfrankel commented 3 months ago

Relevant lines in log crate source code:

https://github.com/rust-lang/log/blob/d5ba2cfee9b3b4ca1fcad911b7f59dc79eeee022/src/lib.rs#L1528

benfrankel commented 3 months ago

Do we have debug_assertions enabled in release builds?

janhohenheim commented 3 months ago

@benfrankel we do not. Try this snippet to confirm:

#[cfg(not(debug_assertions))]
compile_error!("We are running in release mode!");
benfrankel commented 3 months ago

Does the log dependency have debug_assertions enabled when our crate is in release mode? I highly doubt it but IDK how this is possible.

janhohenheim commented 3 months ago

Per @mockersf:

you're setting the feature on the logcrate, but I'm pretty sure Bevy doesn't use it as a backend on the web to be able to log on the console. you should set the log level features on the tracingcrate instead

Update: can confirm that fixes it for https://janhohenheim.itch.io/bike-game