diff --git a/Cargo.lock b/Cargo.lock index a470247..a85223c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2877,7 +2877,6 @@ name = "magnotia-hotkey" version = "0.1.0" dependencies = [ "evdev", - "log", "magnotia-core", "nix 0.29.0", "notify", diff --git a/crates/hotkey/Cargo.toml b/crates/hotkey/Cargo.toml index db00b2c..ae58f4c 100644 --- a/crates/hotkey/Cargo.toml +++ b/crates/hotkey/Cargo.toml @@ -8,7 +8,6 @@ description = "Wayland-compatible global hotkey listener for Magnotia — evdev magnotia-core = { path = "../core" } tokio = { version = "1", features = ["rt", "sync", "macros", "time"] } serde = { version = "1", features = ["derive"] } -log = "0.4" tracing = "0.1" [target.'cfg(target_os = "linux")'.dependencies] diff --git a/crates/hotkey/src/linux.rs b/crates/hotkey/src/linux.rs index 5f18ef0..48649f8 100644 --- a/crates/hotkey/src/linux.rs +++ b/crates/hotkey/src/linux.rs @@ -199,7 +199,7 @@ async fn scan_and_attach( let entries = match std::fs::read_dir(input_dir) { Ok(e) => e, Err(e) => { - log::error!("Cannot read /dev/input: {e}"); + tracing::error!(error = %e, "cannot read /dev/input"); return; } }; @@ -233,7 +233,7 @@ async fn try_attach_device( let device = match Device::open(path) { Ok(d) => d, Err(e) => { - log::debug!("Cannot open {}: {e}", path.display()); + tracing::debug!(path = %path.display(), error = %e, "cannot open device"); return false; } }; @@ -243,10 +243,10 @@ async fn try_attach_device( } let device_name = device.name().unwrap_or("unknown").to_string(); - log::info!( - "Attached hotkey listener to: {} ({})", - device_name, - path.display() + tracing::info!( + device = %device_name, + path = %path.display(), + "attached hotkey listener" ); tracked_set.insert(path.to_path_buf()); @@ -260,7 +260,11 @@ async fn try_attach_device( tokio::spawn(async move { if let Err(e) = device_listener(device, hotkey_rx, event_tx).await { - log::warn!("Device listener for {} ended: {e}", path_owned.display()); + tracing::warn!( + path = %path_owned.display(), + error = %e, + "device listener ended" + ); } // Remove from tracked set so hotplug can re-attach if reconnected tracked.lock().await.remove(&path_owned); @@ -331,8 +335,8 @@ async fn device_listener( // shutdown. Log once and exit so // the listener doesn't spin // sending into a closed channel. - log::warn!( - "Hotkey event channel closed; \ + tracing::warn!( + "hotkey event channel closed; \ listener for device exiting" ); return Ok(()); diff --git a/crates/hotkey/src/stub.rs b/crates/hotkey/src/stub.rs index 34db21f..4ab1361 100644 --- a/crates/hotkey/src/stub.rs +++ b/crates/hotkey/src/stub.rs @@ -19,7 +19,7 @@ pub struct EvdevHotkeyListener; impl EvdevHotkeyListener { pub fn start(_combo: HotkeyCombo, _event_tx: mpsc::Sender) -> Self { - log::info!("evdev hotkey listener is a no-op on this platform"); + tracing::info!("evdev hotkey listener is a no-op on this platform"); Self }