Use logging
This commit is contained in:
+9
-5
@@ -6,6 +6,7 @@ use egui::{
|
||||
ViewportCommand, ViewportId, ViewportInfo,
|
||||
};
|
||||
use gilrs::{EventType, Gilrs};
|
||||
use tracing::{error, warn};
|
||||
use winit::{
|
||||
application::ApplicationHandler,
|
||||
event::WindowEvent,
|
||||
@@ -230,8 +231,8 @@ impl ApplicationHandler<UserEvent> for Application {
|
||||
fn exiting(&mut self, _event_loop: &ActiveEventLoop) {
|
||||
let (sender, receiver) = oneshot::channel();
|
||||
if self.client.send_command(EmulatorCommand::Exit(sender)) {
|
||||
if let Err(err) = receiver.recv_timeout(Duration::from_secs(5)) {
|
||||
eprintln!("could not gracefully exit: {}", err);
|
||||
if let Err(error) = receiver.recv_timeout(Duration::from_secs(5)) {
|
||||
error!(%error, "could not gracefully exit.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -434,9 +435,12 @@ fn create_window_and_state(
|
||||
}
|
||||
|
||||
fn process_gamepad_input(mappings: MappingProvider, proxy: EventLoopProxy<UserEvent>) {
|
||||
let Ok(mut gilrs) = Gilrs::new() else {
|
||||
eprintln!("could not connect gamepad listener");
|
||||
return;
|
||||
let mut gilrs = match Gilrs::new() {
|
||||
Ok(gilrs) => gilrs,
|
||||
Err(error) => {
|
||||
warn!(%error, "could not connect gamepad listener");
|
||||
return;
|
||||
}
|
||||
};
|
||||
while let Some(event) = gilrs.next_event_blocking(None) {
|
||||
if event.event == EventType::Connected {
|
||||
|
||||
Reference in New Issue
Block a user