From 973dd67bd068c34337b55d733aef16cdc6261225 Mon Sep 17 00:00:00 2001 From: lunar-mining Date: Tue, 14 Dec 2021 20:41:51 +0100 Subject: [PATCH] moved some debug! statements to info! --- src/bin/cashierd.rs | 18 +++++++++--------- src/bin/darkfid.rs | 4 ++-- src/rpc/rpcserver.rs | 6 +++--- src/service/bridge.rs | 10 +++++----- src/service/btc.rs | 10 +++++----- src/service/eth.rs | 6 +++--- src/service/sol.rs | 4 ++-- src/wallet/cashierdb.rs | 2 +- src/wallet/walletdb.rs | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/bin/cashierd.rs b/src/bin/cashierd.rs index 360c25a4f..83cfd2b3e 100644 --- a/src/bin/cashierd.rs +++ b/src/bin/cashierd.rs @@ -170,7 +170,7 @@ impl Cashierd { } async fn deposit(&self, id: Value, params: Value, executor: Arc>) -> JsonResult { - debug!(target: "CASHIER DAEMON", "RECEIVED DEPOSIT REQUEST"); + info!(target: "CASHIER DAEMON", "Received deposit request"); let args: &Vec = params.as_array().unwrap(); @@ -295,7 +295,7 @@ impl Cashierd { } async fn withdraw(&self, id: Value, params: Value) -> JsonResult { - debug!(target: "CASHIER DAEMON", "RECEIVED WITHDRAW REQUEST"); + info!(target: "CASHIER DAEMON", "Received withdraw request"); let args: &Vec = params.as_array().unwrap(); @@ -462,7 +462,7 @@ impl Cashierd { match network.name { #[cfg(feature = "sol")] NetworkName::Solana => { - debug!(target: "CASHIER DAEMON", "Add sol network"); + debug!(target: "CASHIER DAEMON", "Adding solana network"); use drk::service::{sol::SolFailed, SolClient}; use solana_sdk::{signature::Signer, signer::keypair::Keypair}; @@ -505,7 +505,7 @@ impl Cashierd { #[cfg(feature = "eth")] NetworkName::Ethereum => { - debug!(target: "CASHIER DAEMON", "Add eth network"); + debug!(target: "CASHIER DAEMON", "Adding ethereum network"); use drk::service::{ eth::{generate_privkey, Keypair}, EthClient, @@ -562,7 +562,7 @@ impl Cashierd { #[cfg(feature = "btc")] NetworkName::Bitcoin => { - debug!(target: "CASHIER DAEMON", "Add btc network"); + debug!(target: "CASHIER DAEMON", "Adding bitcoin network"); use drk::service::btc::{BtcClient, BtcFailed, Keypair}; let bridge2 = self.bridge.clone(); @@ -638,7 +638,7 @@ impl Cashierd { let listen_for_notification_from_bridge_task: smol::Task> = executor.spawn(async move { while let Some(token_notification) = bridge2.clone().listen().await { - debug!(target: "CASHIER DAEMON", "Notification from birdge"); + debug!(target: "CASHIER DAEMON", "Received notification from bridge"); let token_notification = token_notification?; @@ -753,7 +753,7 @@ async fn main() -> Result<()> { let config: CashierdConfig = Config::::load(config_path)?; if args.is_present("refresh") { - debug!(target: "CASHIER DAEMON", "Refresh the wallet and the database"); + info!(target: "CASHIER DAEMON", "Refresh the wallet and the database"); let client_wallet_path = format!("sqlite://{}", expand_path(&config.client_wallet_path)?.to_str().unwrap()); @@ -769,11 +769,11 @@ async fn main() -> Result<()> { wallet.remove_withdraw_and_deposit_keys().await?; if let Some(path) = expand_path(&config.database_path)?.to_str() { - debug!(target: "CASHIER DAEMON", "Remove database: {}", path); + info!(target: "CASHIER DAEMON", "Remove database: {}", path); std::fs::remove_dir_all(path)?; } - info!("Wallet got updated successfully."); + info!("Wallet updated successfully."); return Ok(()) } diff --git a/src/bin/darkfid.rs b/src/bin/darkfid.rs index be6bb7f83..7da2d540a 100644 --- a/src/bin/darkfid.rs +++ b/src/bin/darkfid.rs @@ -635,7 +635,7 @@ async fn main() -> Result<()> { let config: DarkfidConfig = Config::::load(config_path)?; if args.is_present("refresh") { - debug!(target: "DARKFI DAEMON", "Refresh the wallet and the database"); + info!(target: "DARKFI DAEMON", "Refresh the wallet and the database"); let wallet_path = format!("sqlite://{}", expand_path(&config.wallet_path)?.to_str().unwrap()); let wallet = WalletDb::new(&wallet_path, config.wallet_password.clone()).await?; @@ -643,7 +643,7 @@ async fn main() -> Result<()> { wallet.remove_own_coins().await?; if let Some(path) = expand_path(&config.database_path)?.to_str() { - debug!(target: "DARKFI DAEMON", "Remove database: {}", path); + info!(target: "DARKFI DAEMON", "Remove database: {}", path); std::fs::remove_dir_all(path)?; } diff --git a/src/rpc/rpcserver.rs b/src/rpc/rpcserver.rs index cc1a21e6c..00af817c1 100644 --- a/src/rpc/rpcserver.rs +++ b/src/rpc/rpcserver.rs @@ -7,7 +7,7 @@ use std::{ use async_executor::Executor; use async_native_tls::{Identity, TlsAcceptor}; use async_trait::async_trait; -use log::{debug, error}; +use log::{debug, error, info}; use smol::{ io::{AsyncReadExt, AsyncWriteExt}, Async, @@ -123,10 +123,10 @@ async fn listen( ) -> Result<()> { match &tls { None => { - debug!(target: "RPC SERVER", "Listening on tcp://{}", listener.get_ref().local_addr()?) + info!(target: "RPC SERVER", "Listening on tcp://{}", listener.get_ref().local_addr()?) } Some(_) => { - debug!(target: "RPC SERVER", "Listening on tls://{}", listener.get_ref().local_addr()?) + info!(target: "RPC SERVER", "Listening on tls://{}", listener.get_ref().local_addr()?) } } diff --git a/src/service/bridge.rs b/src/service/bridge.rs index bf921940b..e53b04856 100644 --- a/src/service/bridge.rs +++ b/src/service/bridge.rs @@ -4,7 +4,7 @@ use async_executor::Executor; use async_std::sync::{Arc, Mutex}; use async_trait::async_trait; use futures::stream::{FuturesUnordered, StreamExt}; -use log::{debug, error}; +use log::{error, debug}; use crate::{ crypto::keypair::PublicKey, types::*, util::NetworkName, wallet::cashierdb::TokenKey, Error, @@ -76,7 +76,7 @@ impl Bridge { network: NetworkName, client: Arc, ) -> Result<()> { - debug!(target: "BRIDGE", "Add new client"); + debug!(target: "BRIDGE", "Adding new client"); let client2 = client.clone(); let notifier = client2.get_notifier().await?; @@ -92,7 +92,7 @@ impl Bridge { pub async fn listen(self: Arc) -> Option> { if !self.notifiers.is_empty() { - debug!(target: "BRIDGE", "Start listening to new notification"); + debug!(target: "BRIDGE", "Start listening for new notifications"); let notification = self .notifiers .iter() @@ -102,7 +102,7 @@ impl Bridge { .await .map(|o| o.map_err(Error::from)); - debug!(target: "BRIDGE", "End listening to new notification"); + debug!(target: "BRIDGE", "Stop listening for new notifications"); notification } else { @@ -135,7 +135,7 @@ impl Bridge { mint: Option, executor: Arc>, ) -> Result<()> { - debug!(target: "BRIDGE", "Listen for new subscription"); + debug!(target: "BRIDGE", "Listen for new subscriptions"); let req = req.recv().await?; let network = req.network; diff --git a/src/service/btc.rs b/src/service/btc.rs index 707509381..5ffdae2ac 100644 --- a/src/service/btc.rs +++ b/src/service/btc.rs @@ -421,7 +421,7 @@ impl BtcClient { .await .map_err(Error::from)?; - debug!(target: "BTC BRIDGE", "Received {} btc", ui_amnt); + info!(target: "BTC BRIDGE", "Received {} btc", ui_amnt); let _ = self.send_btc_to_main_wallet(amnt as u64, btc_keys).await; Ok(()) @@ -432,7 +432,7 @@ impl BtcClient { amount: u64, btc_keys: Account, ) -> BtcResult<()> { - debug!(target: "BTC BRIDGE", "Sending {} BTC to main wallet", amount); + info!(target: "BTC BRIDGE", "Sending {} BTC to main wallet", amount); let client = self.client.lock().await; let electrum = &client.electrum; let keys_clone = btc_keys.clone(); @@ -490,12 +490,12 @@ impl BtcClient { let _txid = signed_tx.txid(); let _serialized_tx = serialize(&signed_tx); - debug!(target: "BTC BRIDGE", "Signed tx: {:?}", + info!(target: "BTC BRIDGE", "Signed tx: {:?}", serialize_hex(&signed_tx)); let txid = electrum.transaction_broadcast_raw(&signed_tx.serialize().to_vec())?; - debug!(target: "BTC BRIDGE", "Sent {} satoshi to main wallet, txid: {}", amount, txid); + info!(target: "BTC BRIDGE", "Sent {} satoshi to main wallet, txid: {}", amount, txid); Ok(()) } } @@ -603,7 +603,7 @@ impl NetworkClient for BtcClient { .transaction_broadcast_raw(&signed_tx.serialize().to_vec()) .map_err(|e| Error::from(BtcFailed::from(e)))?; - debug!(target: "BTC BRIDGE", "Sent {} satoshi to external wallet, txid: {}", amount, txid); + info!(target: "BTC BRIDGE", "Sent {} satoshi to external wallet, txid: {}", amount, txid); Ok(()) } } diff --git a/src/service/eth.rs b/src/service/eth.rs index ae72dd5a5..057211203 100644 --- a/src/service/eth.rs +++ b/src/service/eth.rs @@ -6,7 +6,7 @@ use async_trait::async_trait; use hash_db::Hasher; use keccak_hasher::KeccakHasher; use lazy_static::lazy_static; -use log::{debug, error}; +use log::{debug, info, error}; use num_bigint::{BigUint, RandBigInt}; use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; @@ -215,7 +215,7 @@ impl EthClient { } async fn send_eth_to_main_wallet(&self, acc: &str, amount: BigUint) -> Result<()> { - debug!(target: "ETH BRIDGE", "Send eth to main wallet"); + info!(target: "ETH BRIDGE", "Sending eth to main wallet"); let tx = EthTx::new(acc, &self.main_keypair.public_key, None, None, Some(amount), None, None); @@ -288,7 +288,7 @@ impl EthClient { self.send_eth_to_main_wallet(&addr, received_balance).await?; - debug!(target: "ETH BRIDGE", "Received {} eth", received_balance_ui ); + info!(target: "ETH BRIDGE", "Received {} eth", received_balance_ui ); Ok(()) } diff --git a/src/service/sol.rs b/src/service/sol.rs index ec9e449c8..c4da5f887 100644 --- a/src/service/sol.rs +++ b/src/service/sol.rs @@ -239,7 +239,7 @@ impl SolClient { .await .map_err(Error::from)?; - debug!(target: "SOL BRIDGE", "Received {} {:?} tokens", ui_amnt, mint.unwrap()); + info!(target: "SOL BRIDGE", "Received {} {:?} tokens", ui_amnt, mint.unwrap()); let _ = self.send_tok_to_main_wallet(&rpc, &mint.unwrap(), amnt, decimals, &keypair)?; } else { let ui_amnt = lamports_to_sol(amnt); @@ -255,7 +255,7 @@ impl SolClient { .await .map_err(Error::from)?; - debug!(target: "SOL BRIDGE", "Received {} SOL", ui_amnt); + info!(target: "SOL BRIDGE", "Received {} SOL", ui_amnt); let _ = self.send_sol_to_main_wallet(&rpc, amnt, &keypair)?; } diff --git a/src/wallet/cashierdb.rs b/src/wallet/cashierdb.rs index a5d24104e..445b8d445 100644 --- a/src/wallet/cashierdb.rs +++ b/src/wallet/cashierdb.rs @@ -55,7 +55,7 @@ impl CashierDb { if path != "sqlite::memory:" { let p = Path::new(path.strip_prefix("sqlite://").unwrap()); if let Some(dirname) = p.parent() { - debug!("Creating path to database: {}", dirname.display()); + info!("Creating path to database: {}", dirname.display()); create_dir_all(&dirname)?; } } diff --git a/src/wallet/walletdb.rs b/src/wallet/walletdb.rs index 84bcd39a1..8d70b6224 100644 --- a/src/wallet/walletdb.rs +++ b/src/wallet/walletdb.rs @@ -54,7 +54,7 @@ impl WalletDb { if path != "sqlite::memory:" { let p = Path::new(path.strip_prefix("sqlite://").unwrap()); if let Some(dirname) = p.parent() { - debug!("Creating path to database: {}", dirname.display()); + info!("Creating path to database: {}", dirname.display()); create_dir_all(&dirname)?; } } @@ -71,7 +71,7 @@ impl WalletDb { } pub async fn init_db(&self) -> Result<()> { - debug!("Initializing wallet database"); + info!("Initializing wallet database"); let keys = include_str!("../../sql/keys.sql"); let coins = include_str!("../../sql/coins.sql");