From d9621cf95201c7a64a365686201f40bbd5952156 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 24 Apr 2024 01:51:51 +0100 Subject: Improve log format consistency --- src/actions.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/actions.rs') diff --git a/src/actions.rs b/src/actions.rs index 7979bd7..0daec15 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -108,10 +108,10 @@ pub async fn get_actions<'a>( // TODO: parallelize this. It's hard because the result vector needs to be shared. for action_config in actions_config { - debug!("registering action '{}'", action_config); + debug!("[{}] registering action", action_config); match get_action(message_config, action_config).await { Ok(action) => { - info!("registered action '{}'", action_config); + info!("[{}] registered action", action_config); result.push(action); } Err(e) => { @@ -127,10 +127,20 @@ pub async fn run_actions( actions: &[&(dyn Action<'_> + Sync)], params: Option>, ) { + let params_ref = params.as_ref(); TokioScope::scope_and_block(|s| { for &action in actions { - debug!("running '{}' action", action.name()); - s.spawn(action.run(params.as_ref())); + s.spawn(async { + info!( + "[{}][{}][{}] running", + params_ref.map(|p| p.wallet()).unwrap_or("wallet"), + params_ref + .map(|p| p.txid_short()) + .unwrap_or("txid".to_string()), + action.name() + ); + action.run(params_ref); + }); } }); } -- cgit v1.2.3-70-g09d2