Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Replace println usage in ws provider (#263)
Browse files Browse the repository at this point in the history
* Replace println usage in ws provider

* fmt
  • Loading branch information
austinabell authored Apr 7, 2021
1 parent 2640757 commit ba41d19
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ethers-providers/src/transports/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use tokio_tungstenite::{
connect_async,
tungstenite::{self, protocol::Message},
};
use tracing::{error, warn};

/// A JSON-RPC Client over Websockets.
///
Expand Down Expand Up @@ -223,22 +224,22 @@ where
sender,
} => {
if self.pending.insert(id, sender).is_some() {
println!("Replacing a pending request with id {:?}", id);
warn!("Replacing a pending request with id {:?}", id);
}

if let Err(e) = self.ws.send(Message::Text(request)).await {
println!("WS connection error: {:?}", e);
error!("WS connection error: {:?}", e);
self.pending.remove(&id);
}
}
TransportMessage::Subscribe { id, sink } => {
if self.subscriptions.insert(id, sink).is_some() {
println!("Replacing already-registered subscription with id {:?}", id);
warn!("Replacing already-registered subscription with id {:?}", id);
}
}
TransportMessage::Unsubscribe { id } => {
if self.subscriptions.remove(&id).is_none() {
println!(
warn!(
"Unsubscribing from non-existent subscription with id {:?}",
id
);
Expand Down

0 comments on commit ba41d19

Please sign in to comment.