From 0c2e129bbdd29cf4f7c5dc8cefadb6f1ee8f5333 Mon Sep 17 00:00:00 2001 From: Jet Pham <55770902+jetpham@users.noreply.github.com> Date: Thu, 5 Jun 2025 08:53:20 -0700 Subject: [PATCH] feat: add starting and itermediate logs --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index dfd3b96..ebe6595 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,8 @@ use tracing::{error, info}; #[tokio::main] async fn main() -> Result<()> { + info!("Starting noisebell..."); + tracing_subscriber::fmt::init(); const DEFAULT_GPIO_PIN: u8 = 17; @@ -21,16 +23,16 @@ async fn main() -> Result<()> { let callback = move |event: gpio::CircuitEvent| { info!("Circuit state changed: {:?}", event); - - // Clone the webhook notifier for the async block + let notifier = webhook_notifier.clone(); - - // Spawn a new task to send webhooks + tokio::spawn(async move { notifier.notify_all("circuit_state_change", event).await; }); }; + info!("starting gpio_monitor"); + if let Err(e) = gpio_monitor.monitor(callback).await { error!("GPIO monitoring error: {}", e); }