-
I tired this: fn keyboard(
keyboard: Res<Input<KeyCode>>,
mut logging: ResMut<LogSettings>,
) {
if keyboard.just_pressed(KeyCode::Grave) {
if logging.level == bevy::log::Level::DEBUG {
logging.level = bevy::log::Level::INFO
} else {
logging.level = bevy::log::Level::DEBUG
};
info!("Log level {level}", level = logging.level);
}
} But it doesn't seem to have any effect on logs. I still don't see any message written with the My use case is troubleshooting web deployments. Sometimes I observe different behavior in production and I would like to see more details to understand what's going on. The deployment process involves pushing a new commit and takes few minutes so changing the code and re-deploying is not a very attractive option. I'm open for alternative solutions, but changing logging level at runtime seems the best. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It's currently not possible to change log levels during runtime, it's set only on startup |
Beta Was this translation helpful? Give feedback.
-
Thank you @mockersf. Your answer hinted me in a right direction. If one thinks about it, "on startup" is also "at runtime". It only means that for the change to take effect, the app must be restarted. This satisfies my use case, since it doesn't require re-deployment, only a page reload. With that in mind I needed a way to pass some user provided flags to the app as it starts. On the web, a natural interface for that are query parameters. This commit shows how to set the log level using URL query parameter: https://gitlab.com/tad-lispy/bevy-animated-sprite-playground/-/commit/1ba23120d3d1c4b7384437e0f87ff73cbd87650b. I hope it will be useful for someone, |
Beta Was this translation helpful? Give feedback.
Thank you @mockersf. Your answer hinted me in a right direction. If one thinks about it, "on startup" is also "at runtime". It only means that for the change to take effect, the app must be restarted. This satisfies my use case, since it doesn't require re-deployment, only a page reload. With that in mind I needed a way to pass some user provided flags to the app as it starts. On the web, a natural interface for that are query parameters. This commit shows how to set the log level using URL query parameter: https://gitlab.com/tad-lispy/bevy-animated-sprite-playground/-/commit/1ba23120d3d1c4b7384437e0f87ff73cbd87650b. I hope it will be useful for someone,