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

@ -157,12 +157,12 @@ impl Wallet {
Err(error) => {
tracing::warn!(
address = %self.main_address,
"Transferring Monero back to default wallet failed. Error {:#}", error
"Failed to transfer Monero to default wallet: {:#}", error
);
}
},
Err(error) => {
tracing::warn!("Refreshing the generated wallet failed. Error {:#}", error);
tracing::warn!("Failed to refresh generated wallet: {:#}", error);
}
}
@ -192,7 +192,7 @@ impl Wallet {
%amount,
to = %public_spend_key,
tx_id = %res.tx_hash,
"Sent transfer"
"Successfully initiated Monero transfer"
);
Ok(TransferProof::new(
@ -202,7 +202,7 @@ impl Wallet {
))
}
pub async fn watch_for_transfer(&self, request: WatchRequest) -> Result<()> {
pub async fn watch_for_transfer(&self, request: WatchRequest) -> Result<(), InsufficientFunds> {
let WatchRequest {
conf_target,
public_view_key,
@ -314,7 +314,7 @@ where
Err(error) => {
tracing::debug!(
%txid,
"Failed to retrieve tx from blockchain. Error {:#}", error
"Failed to retrieve tx from blockchain: {:#}", error
);
continue; // treating every error as transient and retrying
// is obviously wrong but the jsonrpc client is

View file

@ -128,7 +128,7 @@ impl WalletRpc {
tracing::debug!(
%port,
"Starting monero-wallet-rpc on"
"Starting monero-wallet-rpc"
);
let network_flag = match network {