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

Replace println usage in ws provider #263

Merged
merged 2 commits into from
Apr 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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