Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use tokio::task::JoinSet;

pub async fn logwait<T: 'static>(mut joinset: JoinSet<Result<T, anyhow::Error>>) {
  while let Some(r) = joinset.join_next().await {
    match r {
      Err(err) => tracing::error!("join error: {}", err),
      Ok(r) => {
        if let Err(err) = r {
          tracing::error!("{}", err);
        }
      }
    }
  }
}