From 95bd0f41411fb56575dc7339bb36a460ed01a6f2 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 24 Apr 2026 19:17:57 +0200 Subject: feat(engine): add & improve logging in windowing module --- engine/src/windowing.rs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/src/windowing.rs b/engine/src/windowing.rs index a10b7c1..b02a34c 100644 --- a/engine/src/windowing.rs +++ b/engine/src/windowing.rs @@ -156,17 +156,29 @@ fn update_stuff( actions.remove_comps::<(WindowCreationReady,)>(window_ent_id); - tracing::debug!("Added window component to window entity"); + let window_id = WindowId::from_inner(winit_window.id()); - windows.insert( - WindowId::from_inner(winit_window.id()), - (winit_window, window_ent_id), + windows.insert(window_id, (winit_window, window_ent_id)); + + tracing::info!( + window_id = ?window_id, + window_title = window_creation_attrs.title(), + "Window creation completed" ); } MessageFromApp::WindowResized(window_id, new_window_size) => { + tracing::debug!( + window_id = ?window_id, + "Received window resized message" + ); + let Some(window_ent_id) = windows.get(&window_id).map(|(_, ent_id)| ent_id) else { + tracing::error!( + wid = ?window_id, + "Window does not exist in windowing context" + ); continue; }; @@ -467,6 +479,7 @@ struct App impl App { + #[tracing::instrument(skip_all)] fn handle_received_messages(&mut self, event_loop: &ActiveEventLoop) { for message in self.message_to_app_receiver.try_iter() { @@ -489,8 +502,6 @@ impl App }, ); - tracing::info!("Created window has title {}", winit_window.title()); - self.windows.insert( WindowId::from_inner(winit_window.id()), (Arc::downgrade(&winit_window), WindowSettings::default()), @@ -519,6 +530,7 @@ impl App } } + #[tracing::instrument(skip_all)] fn send_message(&self, message: MessageFromApp) { if self.message_from_app_sender.is_full() { @@ -577,6 +589,7 @@ impl ApplicationHandler for App fn resumed(&mut self, _event_loop: &ActiveEventLoop) {} + #[tracing::instrument(skip_all)] fn window_event( &mut self, _event_loop: &ActiveEventLoop, @@ -654,6 +667,7 @@ impl ApplicationHandler for App } } + #[tracing::instrument(skip_all)] fn device_event( &mut self, _event_loop: &ActiveEventLoop, -- cgit v1.2.3-18-g5258