Tidy up log messages across the codebase

1. Clearly separate the log messages from any fields that are
captured. The log message itself should be meaningful because it
depends on the underlying formatter, how/if the fields are displayed.
2. Some log messages had very little context, expand that.
3. Wording of errors was inconsistent, hopefully all errors should
now start with `Failed to ...`.
4. Some log messages were duplicated across multiple layers (like opening
the database).
5. Some log messages were split into two where one part is now an `error!`
and the 2nd part is an `info!` on what is happening next.
6. Where appropriate, punctuation has been removed to not interrupt
the reader's flow.
This commit is contained in:
Thomas Eizinger 2021-07-06 16:42:05 +10:00 committed by Daniel Karzel
parent 78480547d5
commit 9119ce5cc4
No known key found for this signature in database
GPG key ID: 30C3FC2E438ADB6E
13 changed files with 79 additions and 74 deletions

View file

@ -149,11 +149,13 @@ async fn next_state(
received_xmr = monero_wallet.watch_for_transfer(watch_request) => {
match received_xmr {
Ok(()) => BobState::XmrLocked(state.xmr_locked(monero_wallet_restore_blockheight)),
Err(e) => {
tracing::warn!("Waiting for refund because insufficient Monero have been locked! {:#}", e);
tx_lock_status.wait_until_confirmed_with(state.cancel_timelock).await?;
Err(monero::InsufficientFunds { expected, actual }) => {
tracing::warn!("Insufficient Monero have been locked! Expected {} but got {}", expected, actual);
tracing::info!("Waiting for cancel timelock ({}) to expire", state.cancel_timelock);
BobState::CancelTimelockExpired(state.cancel())
tx_lock_status.wait_until_confirmed_with(state.cancel_timelock).await?;
BobState::CancelTimelockExpired(state.cancel())
},
}
}
@ -229,7 +231,7 @@ async fn next_state(
let tx_hashes = monero_wallet.sweep_all(monero_receive_address).await?;
for tx_hash in tx_hashes {
tracing::info!(%monero_receive_address, txid=%tx_hash.0, "Sent XMR to");
tracing::info!(%monero_receive_address, txid=%tx_hash.0, "Successfully transferred XMR to wallet");
}
BobState::XmrRedeemed {