agent: finish tracing migration for hotkey logs
Follow-up to184214b. The eprintln→tracing sweep surfaced 6 existing log::* calls in the hotkey crate that were silent at runtime — the workspace builds tracing-subscriber without the tracing-log feature, so log:: events never reached the tracing pipeline. Migrating direct rather than adding a LogTracer bridge: the repo is already standardising on tracing, the bridge adds a second logger init path with "already initialised" edge cases, and the bridge would indiscriminately route all log records (including future third-party chatter), not just these known sites. Migrated (6 sites, 2 files): - crates/hotkey/src/linux.rs (5) — read /dev/input error, device open debug, device-attached info, device-listener-ended warn, event-channel- closed warn - crates/hotkey/src/stub.rs (1) — non-Linux no-op info Also removed the now-unused log = "0.4" dependency from crates/hotkey/Cargo.toml. magnotia_hotkey=info filter target was already added to init_tracing in184214b, so these events emit at the default level immediately. Verification: - cargo fmt --all -- --check - cargo check -p magnotia-hotkey — clean - cargo check -p magnotia — clean - rg 'log::|eprintln!' crates/hotkey/src/ src-tauri/src/commands/ crates/ai-formatting/src/ — zero hits Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -2877,7 +2877,6 @@ name = "magnotia-hotkey"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"evdev",
|
"evdev",
|
||||||
"log",
|
|
||||||
"magnotia-core",
|
"magnotia-core",
|
||||||
"nix 0.29.0",
|
"nix 0.29.0",
|
||||||
"notify",
|
"notify",
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ description = "Wayland-compatible global hotkey listener for Magnotia — evdev
|
|||||||
magnotia-core = { path = "../core" }
|
magnotia-core = { path = "../core" }
|
||||||
tokio = { version = "1", features = ["rt", "sync", "macros", "time"] }
|
tokio = { version = "1", features = ["rt", "sync", "macros", "time"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
log = "0.4"
|
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ async fn scan_and_attach(
|
|||||||
let entries = match std::fs::read_dir(input_dir) {
|
let entries = match std::fs::read_dir(input_dir) {
|
||||||
Ok(e) => e,
|
Ok(e) => e,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!("Cannot read /dev/input: {e}");
|
tracing::error!(error = %e, "cannot read /dev/input");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -233,7 +233,7 @@ async fn try_attach_device(
|
|||||||
let device = match Device::open(path) {
|
let device = match Device::open(path) {
|
||||||
Ok(d) => d,
|
Ok(d) => d,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::debug!("Cannot open {}: {e}", path.display());
|
tracing::debug!(path = %path.display(), error = %e, "cannot open device");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -243,10 +243,10 @@ async fn try_attach_device(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let device_name = device.name().unwrap_or("unknown").to_string();
|
let device_name = device.name().unwrap_or("unknown").to_string();
|
||||||
log::info!(
|
tracing::info!(
|
||||||
"Attached hotkey listener to: {} ({})",
|
device = %device_name,
|
||||||
device_name,
|
path = %path.display(),
|
||||||
path.display()
|
"attached hotkey listener"
|
||||||
);
|
);
|
||||||
|
|
||||||
tracked_set.insert(path.to_path_buf());
|
tracked_set.insert(path.to_path_buf());
|
||||||
@@ -260,7 +260,11 @@ async fn try_attach_device(
|
|||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
if let Err(e) = device_listener(device, hotkey_rx, event_tx).await {
|
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
|
// Remove from tracked set so hotplug can re-attach if reconnected
|
||||||
tracked.lock().await.remove(&path_owned);
|
tracked.lock().await.remove(&path_owned);
|
||||||
@@ -331,8 +335,8 @@ async fn device_listener(
|
|||||||
// shutdown. Log once and exit so
|
// shutdown. Log once and exit so
|
||||||
// the listener doesn't spin
|
// the listener doesn't spin
|
||||||
// sending into a closed channel.
|
// sending into a closed channel.
|
||||||
log::warn!(
|
tracing::warn!(
|
||||||
"Hotkey event channel closed; \
|
"hotkey event channel closed; \
|
||||||
listener for device exiting"
|
listener for device exiting"
|
||||||
);
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ pub struct EvdevHotkeyListener;
|
|||||||
|
|
||||||
impl EvdevHotkeyListener {
|
impl EvdevHotkeyListener {
|
||||||
pub fn start(_combo: HotkeyCombo, _event_tx: mpsc::Sender<HotkeyEvent>) -> Self {
|
pub fn start(_combo: HotkeyCombo, _event_tx: mpsc::Sender<HotkeyEvent>) -> 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
|
Self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user