Skip to content

Commit

Permalink
fix: better crash logging
Browse files Browse the repository at this point in the history
  • Loading branch information
wvffle committed Nov 2, 2024
1 parent c942bd5 commit 9769ac4
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod tasks;

use color_eyre::eyre::Result;
use tokio::sync::mpsc;
use tracing::info;
use tracing::{error, info};

pub enum Signal {
MessageFromFactorio { username: String, message: String },
Expand All @@ -28,21 +28,34 @@ async fn main() -> Result<()> {
tokio::select! {
_ = tokio::signal::ctrl_c() => { info!("Shutting down..."); },
result = tokio::spawn(scrapper) => {
info!("Scrapper task finished");
result?;
if let Err(e) = result {
error!("Scrapper task failed: {}", e);
} else {
info!("Scrapper task finished");
}

},

result = tokio::spawn(factorio) => {
info!("Factorio tx task finished");
result??;
if let Err(e) = result {
error!("Factorio log reading task failed: {}", e);
} else {
info!("Factorio log reading task finished");
}
},
result = tokio::spawn(telegram) => {
info!("Telegram tx task finished");
result??;
if let Err(e) = result {
error!("Telegram message receiving task failed: {}", e);
} else {
info!("Telegram message receiving task finished");
}
},
result = tokio::spawn(bridge(rx)) => {
info!("Receiver task finished");
result?;
if let Err(e) = result {
error!("Bridge task failed: {}", e);
} else {
info!("Bridge task finished");
}
},
}

Expand Down

0 comments on commit 9769ac4

Please sign in to comment.