From 692133c36b71c2f40c09df71ee67ab412f04270d Mon Sep 17 00:00:00 2001 From: itsscb Date: Tue, 29 Oct 2024 22:38:47 +0100 Subject: [PATCH] feat: add tracing --- src/card_reader.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/card_reader.rs b/src/card_reader.rs index c4595c1..cb513b1 100644 --- a/src/card_reader.rs +++ b/src/card_reader.rs @@ -2,6 +2,7 @@ use std::{sync::Arc, time::Duration}; use crossbeam_channel::Sender; use rusb::UsbContext; +use tracing::{debug, error}; use crate::error::Error; @@ -50,6 +51,7 @@ pub fn read(vid: u16, pid: u16, tx: &Sender>) -> Result<(), Error> { let mut buf = [0; 128]; let mut last_scan = std::time::Instant::now(); + debug!("Card reader ready"); loop { match handle.read_interrupt(0x81, &mut buf, Duration::from_secs(1)) { Ok(_) => { @@ -62,7 +64,7 @@ pub fn read(vid: u16, pid: u16, tx: &Sender>) -> Result<(), Error> { } } Err(rusb::Error::Timeout) => (), - Err(e) => eprintln!("Error: {e}"), + Err(e) => error!("Error: {e}"), } } }