Demote / promote log messages to their appropriate level

pull/243/head
Thomas Eizinger 3 years ago
parent 7387884e6d
commit bbbe5f7ae8
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

@ -35,7 +35,7 @@ use swap::{
},
seed::Seed,
};
use tracing::{debug, error, info, warn, Level};
use tracing::{debug, error, warn, Level};
use tracing_subscriber::FmtSubscriber;
use uuid::Uuid;
@ -63,8 +63,8 @@ async fn main() -> Result<()> {
None => Config::testnet(),
};
info!(
"Database and Seed will be stored in directory: {}",
debug!(
"Database and seed will be stored in {}",
config.data.dir.display()
);
@ -240,7 +240,7 @@ async fn main() -> Result<()> {
cancel_result = cancel => {
match cancel_result? {
Ok((txid, _)) => {
info!("Cancel transaction successfully published with id {}", txid)
debug!("Cancel transaction successfully published with id {}", txid)
}
Err(CancelError::CancelTimelockNotExpiredYet) => error!(
"The Cancel Transaction cannot be published yet, \
@ -353,7 +353,7 @@ async fn init_wallets(
monero_wallet_rpc_url
))?;
info!(
debug!(
"Created Monero wallet for blockchain monitoring with name {}",
MONERO_BLOCKCHAIN_MONITORING_WALLET_NAME
);

@ -6,7 +6,7 @@ use std::{
ffi::OsStr,
path::{Path, PathBuf},
};
use tracing::info;
use tracing::debug;
use url::Url;
pub const DEFAULT_ELECTRUM_HTTP_URL: &str = "https://blockstream.info/testnet/api/";
@ -66,7 +66,7 @@ pub struct ConfigNotInitialized {}
pub fn read_config(config_path: PathBuf) -> Result<Result<Config, ConfigNotInitialized>> {
if config_path.exists() {
info!(
debug!(
"Using config file at default path: {}",
config_path.display()
);

@ -89,14 +89,17 @@ impl Transfer for Wallet {
.transfer(0, amount.as_piconero(), &destination_address.to_string())
.await?;
let tx_hash = TxHash(res.tx_hash);
tracing::info!("Monero tx broadcasted!, tx hash: {:?}", tx_hash);
let tx_key = PrivateKey::from_str(&res.tx_key)?;
let transfer_proof = TransferProof::new(tx_hash, tx_key);
tracing::debug!(" Transfer proof: {:?}", transfer_proof);
Ok(transfer_proof)
tracing::debug!(
"sent transfer of {} to {} in {}",
amount,
public_spend_key,
res.tx_hash
);
Ok(TransferProof::new(
TxHash(res.tx_hash),
PrivateKey::from_str(&res.tx_key)?,
))
}
}

@ -12,7 +12,7 @@ use futures::FutureExt;
use libp2p::{core::Multiaddr, PeerId};
use std::{convert::Infallible, sync::Arc};
use tokio::sync::mpsc::{Receiver, Sender};
use tracing::{debug, error, info};
use tracing::{debug, error, info, trace};
#[derive(Debug)]
pub struct Channels<T> {
@ -200,7 +200,7 @@ impl EventLoop {
if option.is_some() {
let peer_id = self.alice_peer_id;
if self.swarm.pt.is_connected(&peer_id) {
debug!("Already connected to Alice: {}", peer_id);
trace!("Already connected to Alice at {}", peer_id);
let _ = self.conn_established.send(peer_id).await;
} else {
info!("dialing alice: {}", peer_id);

@ -275,7 +275,7 @@ impl State2 {
{
let signed_tx_lock = bitcoin_wallet.sign_tx_lock(self.tx_lock.clone()).await?;
tracing::info!("{}", self.tx_lock.txid());
tracing::debug!("locking BTC in transaction {}", self.tx_lock.txid());
let _ = bitcoin_wallet
.broadcast_signed_transaction(signed_tx_lock)
.await?;

@ -12,7 +12,7 @@ use async_recursion::async_recursion;
use rand::rngs::OsRng;
use std::sync::Arc;
use tokio::select;
use tracing::info;
use tracing::{trace, warn};
use uuid::Uuid;
pub fn is_complete(state: &BobState) -> bool {
@ -61,7 +61,7 @@ async fn run_until_internal(
swap_id: Uuid,
execution_params: ExecutionParams,
) -> Result<BobState> {
info!("Current state: {}", state);
trace!("Current state: {}", state);
if is_target_state(&state) {
Ok(state)
} else {
@ -186,7 +186,7 @@ async fn run_until_internal(
match state4? {
Ok(state4) => BobState::XmrLocked(state4),
Err(InsufficientFunds {..}) => {
info!("The other party has locked insufficient Monero funds! Waiting for refund...");
warn!("The other party has locked insufficient Monero funds! Waiting for refund...");
state.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref()).await?;
let state4 = state.cancel();
BobState::CancelTimelockExpired(state4)

@ -45,7 +45,7 @@ impl Seed {
return Self::from_file(&file_path);
}
tracing::info!("No seed file found, creating at: {}", file_path.display());
tracing::debug!("No seed file found, creating at: {}", file_path.display());
let random_seed = Seed::random()?;
random_seed.write_to(file_path.to_path_buf())?;
@ -61,7 +61,7 @@ impl Seed {
let contents = fs::read_to_string(file)?;
let pem = pem::parse(contents)?;
tracing::info!("Read in seed from file: {}", file.display());
tracing::trace!("Read in seed from {}", file.display());
Self::from_pem(pem)
}

Loading…
Cancel
Save