feat: add starting and itermediate logs
This commit is contained in:
parent
f3e84f63f9
commit
0c2e129bbd
1 changed files with 6 additions and 4 deletions
10
src/main.rs
10
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue