in tests enable daemons logging if log level is Debug

This commit is contained in:
Riccardo Casatta 2021-08-03 12:15:16 +02:00
parent 5cdc5fb58a
commit f57c0ca98e
No known key found for this signature in database
GPG Key ID: FD986A969E450397

View File

@ -10,7 +10,7 @@ use electrsd::bitcoind::BitcoinD;
use electrsd::{bitcoind, Conf, ElectrsD}; use electrsd::{bitcoind, Conf, ElectrsD};
pub use electrum_client::{Client as ElectrumClient, ElectrumApi}; pub use electrum_client::{Client as ElectrumClient, ElectrumApi};
#[allow(unused_imports)] #[allow(unused_imports)]
use log::{debug, error, info, trace}; use log::{debug, error, info, log_enabled, trace, Level};
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
use std::ops::Deref; use std::ops::Deref;
@ -24,12 +24,17 @@ pub struct TestClient {
impl TestClient { impl TestClient {
pub fn new(bitcoind_exe: String, electrs_exe: String) -> Self { pub fn new(bitcoind_exe: String, electrs_exe: String) -> Self {
debug!("launching {} and {}", &bitcoind_exe, &electrs_exe); debug!("launching {} and {}", &bitcoind_exe, &electrs_exe);
let bitcoind = BitcoinD::new(bitcoind_exe).unwrap(); let conf = bitcoind::Conf {
view_stdout: log_enabled!(Level::Debug),
..Default::default()
};
let bitcoind = BitcoinD::with_conf(bitcoind_exe, &conf).unwrap();
let http_enabled = cfg!(feature = "test-esplora"); let http_enabled = cfg!(feature = "test-esplora");
let conf = Conf { let conf = Conf {
http_enabled, http_enabled,
view_stderr: log_enabled!(Level::Debug),
..Default::default() ..Default::default()
}; };
let electrsd = ElectrsD::with_conf(electrs_exe, &bitcoind, &conf).unwrap(); let electrsd = ElectrsD::with_conf(electrs_exe, &bitcoind, &conf).unwrap();