Browse Source

Use logger instead of println

no-contract-setup-message
Philipp Hoenisch 3 years ago
parent
commit
1fd4745319
No known key found for this signature in database GPG Key ID: E5F8E74C672BC666
  1. 2
      daemon/src/maker.rs
  2. 5
      daemon/src/maker_cfd_actor.rs
  3. 4
      daemon/src/maker_inc_connections_actor.rs
  4. 2
      daemon/src/send_wire_message_actor.rs
  5. 2
      daemon/src/taker.rs
  6. 2
      daemon/src/taker_cfd_actor.rs
  7. 2
      daemon/src/taker_inc_message_actor.rs

2
daemon/src/maker.rs

@ -98,7 +98,7 @@ async fn main() -> Result<()> {
let listener = tokio::net::TcpListener::bind(&format!("0.0.0.0:{}", opts.p2p_port)).await?;
let local_addr = listener.local_addr().unwrap();
println!("Listening on {}", local_addr);
tracing::info!("Listening on {}", local_addr);
rocket::custom(figment)
.manage(cfd_feed_receiver)

5
daemon/src/maker_cfd_actor.rs

@ -68,9 +68,8 @@ pub fn new(
order_id,
quantity,
} => {
println!(
"Taker {} wants to take {} of order {}",
taker_id, quantity, order_id
tracing::debug!(%taker_id, %quantity, %order_id,
"Taker wants to take an order"
);
let mut conn = db.acquire().await.unwrap();

4
daemon/src/maker_inc_connections_actor.rs

@ -43,7 +43,7 @@ pub fn new(
loop {
tokio::select! {
Ok((socket, remote_addr)) = listener.accept() => {
println!("Connected to {}", remote_addr);
tracing::info!("Connected to {}", remote_addr);
let taker_id = TakerId::default();
let (read, write) = socket.into_split();
@ -114,7 +114,7 @@ fn in_taker_messages(
.send(maker_cfd_actor::Command::IncProtocolMsg(msg))
.unwrap(),
Err(error) => {
eprintln!("Error in reading message: {}", error);
tracing::error!(%error, "Error in reading message");
}
}
}

2
daemon/src/send_wire_message_actor.rs

@ -20,7 +20,7 @@ where
{
Ok(_) => {}
Err(_) => {
eprintln!("TCP connection error");
tracing::error!("TCP connection error");
break;
}
}

2
daemon/src/taker.rs

@ -100,7 +100,7 @@ async fn main() -> Result<()> {
if let Ok(connection) = socket.connect(opts.taker).await {
break connection.into_split();
} else {
println!(
tracing::warn!(
"Could not connect to the maker, retrying in {}s ...",
CONNECTION_RETRY_INTERVAL.as_secs()
);

2
daemon/src/taker_cfd_actor.rs

@ -57,7 +57,7 @@ pub fn new(
let current_order = load_order_by_id(order_id, &mut conn).await.unwrap();
println!("Accepting current order: {:?}", &current_order);
tracing::info!("Accepting current order: {:?}", &current_order);
let cfd = Cfd::new(
current_order.clone(),

2
daemon/src/taker_inc_message_actor.rs

@ -43,7 +43,7 @@ pub fn new(
.unwrap();
}
Err(error) => {
eprintln!("Error in reading message: {}", error);
tracing::error!("Error in reading message: {}", error);
}
}
}

Loading…
Cancel
Save