wip: add env filter

This commit is contained in:
Tobin C. Harding 2020-10-29 11:36:57 +11:00 committed by Lucas Soriano del Pino
parent 3e2f0b74a2
commit b8ab4b4eee
3 changed files with 11 additions and 12 deletions

View File

@ -12,7 +12,7 @@ atty = "0.2"
backoff = { version = "0.2", features = ["tokio"] }
base64 = "0.12"
bitcoin = { version = "0.23", features = ["rand", "use-serde"] } # TODO: Upgrade other crates in this repo to use this version.
bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs", rev = "7ff30a559ab57cc3aa71189e71433ef6b2a6c3a2" }
bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs", rev = "b56ac243eade11e817aa670d546892852a609e7d" }
derivative = "2"
futures = { version = "0.3", default-features = false }
genawaiter = "0.99.1"

View File

@ -70,7 +70,7 @@ impl RequestResponseCodec for Codec {
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
let mut de = serde_cbor::Deserializer::from_slice(&message);
let msg = BobToAlice::deserialize(&mut de)
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
Ok(msg)
}
@ -102,8 +102,11 @@ impl RequestResponseCodec for Codec {
where
T: AsyncWrite + Unpin + Send,
{
let bytes =
serde_cbor::to_vec(&req).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
let bytes = serde_cbor::to_vec(&req).map_err(|e| {
tracing::debug!("yes Lucas we are actually here");
io::Error::new(io::ErrorKind::InvalidData, e)
})?;
upgrade::write_one(io, &bytes).await?;
Ok(())

View File

@ -1,7 +1,6 @@
use bitcoin_harness::Bitcoind;
use futures::{channel::mpsc, future::try_join};
use libp2p::Multiaddr;
use log::LevelFilter;
use monero_harness::Monero;
use std::sync::Arc;
use swap::{alice, bob};
@ -11,13 +10,10 @@ use tracing_subscriber::util::SubscriberInitExt;
#[tokio::test]
async fn swap() {
let _guard = tracing_subscriber::fmt()
.with_env_filter(format!(
"swap={},xmr_btc={},libp2p={}",
LevelFilter::Debug,
LevelFilter::Debug,
LevelFilter::Debug
))
.with_ansi(false)
.with_env_filter(
"swap=debug,hyper=off,reqwest=off,monero-harness=info,testcontainers=info,libp2p=debug",
)
.with_ansi(true)
.set_default();
let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9876"