|
18 | 18 | * |
19 | 19 | */ |
20 | 20 |
|
| 21 | +use std::any::type_name; |
| 22 | +use std::borrow::Cow; |
21 | 23 | use std::error::Error as StdError; |
22 | 24 | use std::ops::ControlFlow; |
23 | 25 | use std::time::{ |
@@ -267,6 +269,23 @@ where |
267 | 269 | while let Some(node_index) = random_node_indexes.next().await { |
268 | 270 | let tmp = execute_single(ctx, executable, node_index, &mut transaction_id).await; |
269 | 271 |
|
| 272 | + log::log!( |
| 273 | + match &tmp { |
| 274 | + Ok(ControlFlow::Break(_)) => log::Level::Debug, |
| 275 | + Ok(ControlFlow::Continue(_)) => log::Level::Warn, |
| 276 | + Err(_) => log::Level::Error, |
| 277 | + }, |
| 278 | + "Execution of {} on node at index {node_index} / node id {} {}", |
| 279 | + type_name::<E>(), |
| 280 | + ctx.network.channel(node_index).0, |
| 281 | + match &tmp { |
| 282 | + Ok(ControlFlow::Break(_)) => Cow::Borrowed("succeeded"), |
| 283 | + Ok(ControlFlow::Continue(err)) => |
| 284 | + format!("will continue due to {err:?}").into(), |
| 285 | + Err(err) => format!("failed due to {err:?}").into(), |
| 286 | + }, |
| 287 | + ); |
| 288 | + |
270 | 289 | match tmp? { |
271 | 290 | ControlFlow::Continue(err) => last_error = Some(err), |
272 | 291 | ControlFlow::Break(res) => return Ok(res), |
@@ -355,6 +374,11 @@ async fn execute_single<E: Execute + Sync>( |
355 | 374 | ) -> retry::Result<ControlFlow<E::Response, Error>> { |
356 | 375 | let (node_account_id, channel) = ctx.network.channel(node_index); |
357 | 376 |
|
| 377 | + log::debug!( |
| 378 | + "Executing {} on node at index {node_index} / node id {node_account_id}", |
| 379 | + type_name::<E>() |
| 380 | + ); |
| 381 | + |
358 | 382 | let (request, context) = executable |
359 | 383 | .make_request(transaction_id.as_ref(), node_account_id) |
360 | 384 | .map_err(crate::retry::Error::Permanent)?; |
|
0 commit comments