moved some debug! statements to info!

This commit is contained in:
lunar-mining
2021-12-14 20:41:51 +01:00
parent b5ce29e4dd
commit 973dd67bd0
9 changed files with 32 additions and 32 deletions

View File

@@ -170,7 +170,7 @@ impl Cashierd {
}
async fn deposit(&self, id: Value, params: Value, executor: Arc<Executor<'_>>) -> JsonResult {
debug!(target: "CASHIER DAEMON", "RECEIVED DEPOSIT REQUEST");
info!(target: "CASHIER DAEMON", "Received deposit request");
let args: &Vec<serde_json::Value> = 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<serde_json::Value> = 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<Result<()>> =
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::<CashierdConfig>::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(())
}

View File

@@ -635,7 +635,7 @@ async fn main() -> Result<()> {
let config: DarkfidConfig = Config::<DarkfidConfig>::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)?;
}

View File

@@ -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()?)
}
}

View File

@@ -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<dyn NetworkClient + Send + Sync>,
) -> 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<Self>) -> Option<Result<TokenNotification>> {
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<String>,
executor: Arc<Executor<'_>>,
) -> Result<()> {
debug!(target: "BRIDGE", "Listen for new subscription");
debug!(target: "BRIDGE", "Listen for new subscriptions");
let req = req.recv().await?;
let network = req.network;

View File

@@ -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(())
}
}

View File

@@ -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(())
}

View File

@@ -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)?;
}

View File

@@ -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)?;
}
}

View File

@@ -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");