diff --git a/swap/src/asb/config.rs b/swap/src/asb/config.rs index 1ecbebe0..52cc0bee 100644 --- a/swap/src/asb/config.rs +++ b/swap/src/asb/config.rs @@ -14,7 +14,6 @@ use std::ffi::OsStr; use std::fs; use std::path::{Path, PathBuf}; use std::str::FromStr; -use tracing::info; use url::Url; pub trait GetDefaults { @@ -178,7 +177,7 @@ pub struct ConfigNotInitialized {} pub fn read_config(config_path: PathBuf) -> Result> { if config_path.exists() { - info!( + tracing::info!( path = %config_path.display(), "Using config file at", ); @@ -198,7 +197,7 @@ pub fn initial_setup(config_path: PathBuf, config: Config) -> Result<()> { ensure_directory_exists(config_path.as_path())?; fs::write(&config_path, toml)?; - info!( + tracing::info!( path = %config_path.as_path().display(), "Initial setup complete, config file created", ); diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs index 35a7e436..46fba70b 100644 --- a/swap/src/bin/asb.rs +++ b/swap/src/bin/asb.rs @@ -36,7 +36,6 @@ use swap::protocol::alice::run; use swap::seed::Seed; use swap::tor::AuthenticatedClient; use swap::{asb, bitcoin, kraken, monero, tor}; -use tracing::{debug, info, warn}; use tracing_subscriber::filter::LevelFilter; const DEFAULT_WALLET_NAME: &str = "asb-wallet"; @@ -90,7 +89,7 @@ async fn main() -> Result<()> { )); } - info!( + tracing::info!( db_folder = %config.data.dir.display(), "Database and Seed will be stored in", ); @@ -110,17 +109,17 @@ async fn main() -> Result<()> { let monero_wallet = init_monero_wallet(&config, env_config).await?; let bitcoin_balance = bitcoin_wallet.balance().await?; - info!(%bitcoin_balance, "Initialized Bitcoin wallet"); + tracing::info!(%bitcoin_balance, "Initialized Bitcoin wallet"); let monero_balance = monero_wallet.get_balance().await?; if monero_balance == Amount::ZERO { let monero_address = monero_wallet.get_main_address(); - warn!( + tracing::warn!( %monero_address, "The Monero balance is 0, make sure to deposit funds at", ) } else { - info!(%monero_balance, "Initialized Monero wallet"); + tracing::info!(%monero_balance, "Initialized Monero wallet"); } let kraken_price_updates = kraken::connect(config.maker.price_ticker_ws_url.clone())?; @@ -314,7 +313,7 @@ async fn init_bitcoin_wallet( seed: &Seed, env_config: swap::env::Config, ) -> Result { - debug!("Opening Bitcoin wallet"); + tracing::debug!("Opening Bitcoin wallet"); let wallet_dir = config.data.dir.join("wallet"); let wallet = bitcoin::Wallet::new( @@ -336,7 +335,7 @@ async fn init_monero_wallet( config: &Config, env_config: swap::env::Config, ) -> Result { - debug!("Opening Monero wallet"); + tracing::debug!("Opening Monero wallet"); let wallet = monero::Wallet::open_or_create( config.monero.wallet_rpc_url.clone(), DEFAULT_WALLET_NAME.to_string(), diff --git a/swap/src/bin/swap.rs b/swap/src/bin/swap.rs index 7018d43a..5d23f3ff 100644 --- a/swap/src/bin/swap.rs +++ b/swap/src/bin/swap.rs @@ -34,7 +34,6 @@ use swap::protocol::bob; use swap::protocol::bob::Swap; use swap::seed::Seed; use swap::{bitcoin, cli, monero}; -use tracing::{debug, error, info, warn}; use url::Url; use uuid::Uuid; @@ -111,7 +110,7 @@ async fn main() -> Result<()> { ) .await?; - info!(%amount, %fees, %swap_id, "Swapping"); + tracing::info!(%amount, %fees, %swap_id, "Swapping"); db.insert_peer_id(swap_id, seller_peer_id).await?; db.insert_monero_address(swap_id, monero_receive_address) @@ -242,9 +241,9 @@ async fn main() -> Result<()> { match cancel { Ok((txid, _)) => { - debug!("Cancel transaction successfully published with id {}", txid) + tracing::debug!("Cancel transaction successfully published with id {}", txid) } - Err(cli::cancel::Error::CancelTimelockNotExpiredYet) => error!( + Err(cli::cancel::Error::CancelTimelockNotExpiredYet) => tracing::error!( "The Cancel Transaction cannot be published yet, because the timelock has not expired. Please try again later" ), } @@ -395,9 +394,9 @@ where TS: Future>, FS: Fn() -> TS, { - debug!("Requesting quote"); + tracing::debug!("Requesting quote"); let bid_quote = bid_quote.await?; - info!( + tracing::info!( price = %bid_quote.price, minimum_amount = %bid_quote.min_quantity, maximum_amount = %bid_quote.max_quantity, @@ -415,7 +414,7 @@ where eprintln!("{}", qr_code(&deposit_address)?); } - info!( + tracing::info!( %deposit_address, %max_giveable, %minimum_amount, diff --git a/swap/src/protocol/alice/swap.rs b/swap/src/protocol/alice/swap.rs index c15892a1..da7cc099 100644 --- a/swap/src/protocol/alice/swap.rs +++ b/swap/src/protocol/alice/swap.rs @@ -8,7 +8,6 @@ use crate::{bitcoin, database, monero}; use anyhow::{bail, Context, Result}; use tokio::select; use tokio::time::timeout; -use tracing::{error, info, warn}; use uuid::Uuid; pub async fn run(swap: Swap, rate_service: LR) -> Result @@ -66,7 +65,7 @@ where .latest_rate() .map_or("NaN".to_string(), |rate| format!("{}", rate)); - info!(%state, %rate, "Advancing state"); + tracing::info!(%state, %rate, "Advancing state"); Ok(match state { AliceState::Started { state3 } => { @@ -78,7 +77,7 @@ where .await { Err(_) => { - info!( + tracing::info!( minutes = %env_config.bitcoin_lock_mempool_timeout.as_secs_f64() / 60.0, "TxLock lock was not seen in mempool in time", ); @@ -99,7 +98,7 @@ where .await { Err(_) => { - info!( + tracing::info!( confirmations_needed = %env_config.bitcoin_finality_confirmations, minutes = %env_config.bitcoin_lock_confirmed_timeout.as_secs_f64() / 60.0, "TxLock lock did not get enough confirmations in time", @@ -204,7 +203,7 @@ where } } enc_sig = event_loop_handle.recv_encrypted_signature() => { - info!("Received encrypted signature"); + tracing::info!("Received encrypted signature"); AliceState::EncSigLearned { monero_wallet_restore_blockheight, @@ -232,7 +231,7 @@ where } }, Err(error) => { - error!( + tracing::error!( "Publishing the redeem transaction failed. Error {:#}", error ); @@ -248,7 +247,7 @@ where } }, Err(error) => { - error!( + tracing::error!( "Constructing the redeem transaction failed. Attempting to wait for cancellation now. Error {:#}", error); tx_lock_status .wait_until_confirmed_with(state3.cancel_timelock) @@ -361,7 +360,7 @@ where match punish { Ok(_) => AliceState::BtcPunished, Err(error) => { - warn!( + tracing::warn!( "Falling back to refund because punish transaction failed. Error {:#}", error );