Replace log with tracing

Tracing is a modern replacement for the log crate that allows for
annotating log messages with the function that they come from.

Signed-off-by: John Nunley <dev@notgull.net>
Closes: #3482
This commit is contained in:
John Nunley 2024-02-25 19:20:39 -08:00 committed by Kirill Chibisov
parent 96172693fe
commit 944347696a
44 changed files with 249 additions and 68 deletions

View file

@ -174,7 +174,7 @@ pub fn character_map_and_combine_key(
let key_map = match app.device_key_character_map(device_id) {
Ok(key_map) => key_map,
Err(err) => {
log::warn!("Failed to look up `KeyCharacterMap` for device {device_id}: {err:?}");
tracing::warn!("Failed to look up `KeyCharacterMap` for device {device_id}: {err:?}");
return None;
}
};
@ -188,7 +188,7 @@ pub fn character_map_and_combine_key(
Ok(Some(key)) => Some(key),
Ok(None) => None,
Err(err) => {
log::warn!("KeyEvent: Failed to combine 'dead key' accent '{accent}' with '{unicode}': {err:?}");
tracing::warn!("KeyEvent: Failed to combine 'dead key' accent '{accent}' with '{unicode}': {err:?}");
None
}
}
@ -213,7 +213,7 @@ pub fn character_map_and_combine_key(
None
}
Err(err) => {
log::warn!("KeyEvent: Failed to get key map character: {err:?}");
tracing::warn!("KeyEvent: Failed to get key map character: {err:?}");
*combining_accent = None;
None
}

View file

@ -16,7 +16,7 @@ use android_activity::input::{InputEvent, KeyAction, Keycode, MotionAction};
use android_activity::{
AndroidApp, AndroidAppWaker, ConfigurationRef, InputStatus, MainEvent, Rect,
};
use log::{debug, trace, warn};
use tracing::{debug, trace, warn};
use crate::{
cursor::Cursor,
@ -330,7 +330,7 @@ impl<T: 'static> EventLoop<T> {
}
},
Err(err) => {
log::warn!("Failed to get input events iterator: {err:?}");
tracing::warn!("Failed to get input events iterator: {err:?}");
}
}
@ -1014,7 +1014,7 @@ impl Window {
if let Some(native_window) = self.app.native_window().as_ref() {
native_window.raw_window_handle()
} else {
log::error!("Cannot get the native window, it's null and will always be null before Event::Resumed and after Event::Suspended. Make sure you only call this function between those events.");
tracing::error!("Cannot get the native window, it's null and will always be null before Event::Resumed and after Event::Suspended. Make sure you only call this function between those events.");
Err(rwh_06::HandleError::Unavailable)
}
}