summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2024-04-24 01:51:51 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2024-04-24 01:51:51 +0100
commitd9621cf95201c7a64a365686201f40bbd5952156 (patch)
tree1130b833b10d95bc9c4450b93e4b2b485deb8671 /src
parentee215982330c2670308e234429dd496d7f655c8f (diff)
downloadsentrum-d9621cf95201c7a64a365686201f40bbd5952156.tar.gz
sentrum-d9621cf95201c7a64a365686201f40bbd5952156.tar.bz2
sentrum-d9621cf95201c7a64a365686201f40bbd5952156.zip
Improve log format consistency
Diffstat (limited to 'src')
-rw-r--r--src/actions.rs18
-rw-r--r--src/main.rs6
2 files changed, 19 insertions, 5 deletions
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<MessageParams<'_, '_>>,
) {
+ 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);
+ });
}
});
}
diff --git a/src/main.rs b/src/main.rs
index f719433..14b660c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -74,7 +74,11 @@ async fn get_and_handle_new_txs(
TokioScope::scope_and_block(|s| {
for tx in txs.iter() {
let params = MessageParams::new(tx, &locked_wallet_info);
- info!("running actions for txid '{}'", params.txid_short());
+ info!(
+ "[{}][{}] running actions",
+ params.wallet(),
+ params.txid_short()
+ );
s.spawn(run_actions(actions, Some(params)));
}
});