feat: add starting and itermediate logs

This commit is contained in:
Jet Pham 2025-06-05 08:53:20 -07:00
parent f3e84f63f9
commit 0c2e129bbd
No known key found for this signature in database

View file

@ -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);
}