Repository: scs/substrate-api-client (language: rust)

Issue:
log level of metadata blob should be `trace`
with `RUST_LOG=info` I get a ton of data which isn't helpful in 99% of all cases

```
[2023-07-20T15:03:15Z INFO  substrate_api_client::rpc::ws_client] sending request: {"id":"1","jsonrpc":"2.0","method":"state_getMetadata","params":[null]}
[2023-07-20T15:03:15Z INFO  substrate_api_client::rpc::ws_client] Got get_request_msg {"jsonrpc":"2.0","result":"0x6d6574610eb103000c1c73705f...   KILOBYTES .... .84ad03","id":"1"}
```
as these log messages are generic, and in general very helpful to be in info level (or maybe debug)
It may make sense to send the log to trace if the message is bigger than a certain size and only report a digest on info level




Discussion / hints:

Fix patch:
diff --git a/src/rpc/tungstenite_client/client.rs b/src/rpc/tungstenite_client/client.rs
index 906f11ec5..597f6baf7 100644
--- a/src/rpc/tungstenite_client/client.rs
+++ b/src/rpc/tungstenite_client/client.rs
@@ -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)
@@ -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) {
@@ -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");
 			},
diff --git a/src/rpc/ws_client/mod.rs b/src/rpc/ws_client/mod.rs
index 714658043..3ddf77a8c 100644
--- a/src/rpc/ws_client/mod.rs
+++ b/src/rpc/ws_client/mod.rs
@@ -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(())
 	}
@@ -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);
@@ -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() {


Test patch: