Logging: RUST_LOG prints to stderr, and start-up logs its milestones (#234)

The logger kept warnings in memory and wrote to a file only after Help
▸ Enable Logging, and it ignored RUST_LOG. An app that never opens its
window (macOS 27 on Apple Silicon, #234) therefore left no trace. Now
RUST_LOG (a level, or env_logger-style `target=level` directives)
also prints what it lets through to stderr, including eframe, winit
and wgpu. The desktop app logs its start-up milestones: opening the
window, the graphics adapter, the app created, the first frame drawn,
the window being asked to close, and the window closed.

Test: rust_log_filters_by_level_and_target (engine logging). Checked
by running the app with RUST_LOG=info and quitting it over the control
channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-08 13:32:16 +07:00
co-authored by Claude Opus 5.5
parent 5a7119d5fa
commit 468ed0b297
3 changed files with 80 additions and 6 deletions
+2
View File
@@ -49,6 +49,8 @@ pub fn on_close_requested(app: &mut EffectcraftApp, ctx: &egui::Context) {
if !ctx.input(|i| i.viewport().close_requested()) || app.dialog_state.unsaved.quitting {
return;
}
// Logged, so a window that closes on its own shows it (#234).
log::info!("the window was asked to close");
if ask(app, "app.quit", &json!({})) {
ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose);
}