Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower log-level of messages of tungstenite and ws-rpc clients #674

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
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: 3 additions & 6 deletions src/rpc/tungstenite_client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl TungsteniteRpcClient {

let msg = read_until_text_message(&mut socket)?;

debug!("Got get_request_msg {}", msg);
trace!("Got get_request_msg {}", msg);
let result_str =
serde_json::from_str(msg.as_str()).map(|v: Value| v["result"].to_string())?;
Ok(result_str)
Expand Down Expand Up @@ -165,7 +165,7 @@ fn send_message_to_client(
message: &str,
subscription_id: &str,
) -> Result<()> {
info!("got on_subscription_msg {}", message);
trace!("got on_subscription_msg {}", message);
let value: Value = serde_json::from_str(message)?;

if helpers::subscription_id_matches(&value, subscription_id) {
Expand Down Expand Up @@ -193,10 +193,7 @@ fn attempt_connection_until(url: &Url, max_attempts: u8) -> Result<(MySocket, Re
fn read_until_text_message(socket: &mut MySocket) -> Result<String> {
loop {
match socket.read()? {
Message::Text(s) => {
debug!("receive text: {:?}", s);
break Ok(s)
},
Message::Text(s) => break Ok(s),
Message::Binary(_) => {
debug!("skip binary msg");
},
Expand Down
6 changes: 3 additions & 3 deletions src/rpc/ws_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ where
MessageHandler::Context: From<MessageContext<MessageHandler::ThreadMessage>>,
{
fn on_open(&mut self, _: Handshake) -> WsResult<()> {
info!("sending request: {}", self.request);
trace!("sending request: {}", self.request);
self.out.send(self.request.clone())?;
Ok(())
}
Expand Down Expand Up @@ -91,7 +91,7 @@ impl HandleMessage for RequestHandler {
out.close(CloseCode::Normal)
.unwrap_or_else(|_| warn!("Could not close Websocket normally"));

info!("Got get_request_msg {}", msg);
trace!("Got get_request_msg {}", msg);
let result_str = serde_json::from_str(msg.as_text()?)
.map(|v: serde_json::Value| v["result"].to_string())
.map_err(RpcClientError::SerdeJson);
Expand All @@ -114,7 +114,7 @@ impl HandleMessage for SubscriptionHandler {
let out = &context.out;
let msg = &context.msg.as_text()?;

info!("got on_subscription_msg {}", msg);
trace!("got on_subscription_msg {}", msg);
let value: serde_json::Value = serde_json::from_str(msg).map_err(Box::new)?;

let send_result = match self.subscription_id.as_ref() {
Expand Down