Replace println usage in ws provider (#263)

* Replace println usage in ws provider

* fmt
This commit is contained in:
Austin Abell 2021-04-07 14:42:10 -04:00 committed by GitHub
parent 2640757d8a
commit ba41d19089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -25,6 +25,7 @@ use tokio_tungstenite::{
connect_async,
tungstenite::{self, protocol::Message},
};
use tracing::{error, warn};
/// A JSON-RPC Client over Websockets.
///
@ -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
);