Browse Source
Use logger instead of println
no-contract-setup-message
Philipp Hoenisch
3 years ago
No known key found for this signature in database
GPG Key ID: E5F8E74C672BC666
7 changed files with
9 additions and
10 deletions
-
daemon/src/maker.rs
-
daemon/src/maker_cfd_actor.rs
-
daemon/src/maker_inc_connections_actor.rs
-
daemon/src/send_wire_message_actor.rs
-
daemon/src/taker.rs
-
daemon/src/taker_cfd_actor.rs
-
daemon/src/taker_inc_message_actor.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) |
|
|
|
|
|
@ -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(); |
|
|
|
|
|
@ -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"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -20,7 +20,7 @@ where |
|
|
|
{ |
|
|
|
Ok(_) => {} |
|
|
|
Err(_) => { |
|
|
|
eprintln!("TCP connection error"); |
|
|
|
tracing::error!("TCP connection error"); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -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() |
|
|
|
); |
|
|
|
|
|
@ -57,7 +57,7 @@ pub fn new( |
|
|
|
|
|
|
|
let current_order = load_order_by_id(order_id, &mut conn).await.unwrap(); |
|
|
|
|
|
|
|
println!("Accepting current order: {:?}", ¤t_order); |
|
|
|
tracing::info!("Accepting current order: {:?}", ¤t_order); |
|
|
|
|
|
|
|
let cfd = Cfd::new( |
|
|
|
current_order.clone(), |
|
|
|
|
|
@ -43,7 +43,7 @@ pub fn new( |
|
|
|
.unwrap(); |
|
|
|
} |
|
|
|
Err(error) => { |
|
|
|
eprintln!("Error in reading message: {}", error); |
|
|
|
tracing::error!("Error in reading message: {}", error); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|