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

downgrade parsing JSON-RPC params logs to debug/trace #1127

Merged
merged 1 commit into from
May 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
12 changes: 6 additions & 6 deletions proc-macros/src/render_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ impl RpcDescription {
let #name: #ty = match seq.optional_next() {
Ok(v) => v,
Err(e) => {
#tracing::warn!(concat!("Error parsing optional \"", stringify!(#name), "\" as \"", stringify!(#ty), "\": {:?}"), e);
#tracing::debug!(concat!("Error parsing optional \"", stringify!(#name), "\" as \"", stringify!(#ty), "\": {:?}"), e);
#pending.reject(e).await;
return #sub_err::None;
}
Expand All @@ -310,7 +310,7 @@ impl RpcDescription {
let #name: #ty = match seq.optional_next() {
Ok(v) => v,
Err(e) => {
#tracing::warn!(concat!("Error parsing optional \"", stringify!(#name), "\" as \"", stringify!(#ty), "\": {:?}"), e);
#tracing::debug!(concat!("Error parsing optional \"", stringify!(#name), "\" as \"", stringify!(#ty), "\": {:?}"), e);
return #response_payload::Error(e);
}
};
Expand All @@ -321,7 +321,7 @@ impl RpcDescription {
let #name: #ty = match seq.next() {
Ok(v) => v,
Err(e) => {
#tracing::warn!(concat!("Error parsing optional \"", stringify!(#name), "\" as \"", stringify!(#ty), "\": {:?}"), e);
#tracing::debug!(concat!("Error parsing optional \"", stringify!(#name), "\" as \"", stringify!(#ty), "\": {:?}"), e);
#pending.reject(e).await;
return #sub_err::None;
}
Expand All @@ -333,7 +333,7 @@ impl RpcDescription {
let #name: #ty = match seq.next() {
Ok(v) => v,
Err(e) => {
#tracing::warn!(concat!("Error parsing \"", stringify!(#name), "\" as \"", stringify!(#ty), "\": {:?}"), e);
#tracing::debug!(concat!("Error parsing \"", stringify!(#name), "\" as \"", stringify!(#ty), "\": {:?}"), e);
return #response_payload::Error(e);
}
};
Expand Down Expand Up @@ -399,7 +399,7 @@ impl RpcDescription {
let parsed: ParamsObject<#(#types,)*> = match params.parse() {
Ok(p) => p,
Err(e) => {
#tracing::warn!("Failed to parse JSON-RPC params as object: {}", e);
#tracing::debug!("Failed to parse JSON-RPC params as object: {}", e);
#pending.reject(e).await;
return #sub_err::None;
}
Expand All @@ -418,7 +418,7 @@ impl RpcDescription {
let parsed: ParamsObject<#(#types,)*> = match params.parse() {
Ok(p) => p,
Err(e) => {
#tracing::warn!("Failed to parse JSON-RPC params as object: {}", e);
#tracing::debug!("Failed to parse JSON-RPC params as object: {}", e);
return #response_payload::Error(e);
}
};
Expand Down
4 changes: 2 additions & 2 deletions server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ where
stopped = stop;
}
AcceptConnection::Err((e, stop)) => {
tracing::error!("Error while awaiting a new connection: {:?}", e);
tracing::debug!("Error while awaiting a new connection: {:?}", e);
stopped = stop;
}
AcceptConnection::Shutdown => break,
Expand Down Expand Up @@ -663,7 +663,7 @@ impl<L: Logger> hyper::service::Service<hyper::Request<hyper::Body>> for TowerSe
response.map(|()| hyper::Body::empty())
}
Err(e) => {
tracing::error!("Could not upgrade connection: {}", e);
tracing::debug!("Could not upgrade connection: {}", e);
hyper::Response::new(hyper::Body::from(format!("Could not upgrade connection: {e}")))
}
};
Expand Down
4 changes: 2 additions & 2 deletions server/src/transport/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub(crate) async fn process_validated_request<L: Logger>(
Err(GenericTransportError::TooLarge) => return response::too_large(max_request_body_size),
Err(GenericTransportError::Malformed) => return response::malformed(),
Err(GenericTransportError::Inner(e)) => {
tracing::error!("Internal error reading request body: {}", e);
tracing::warn!("Internal error reading request body: {}", e);
return response::internal_error();
}
};
Expand Down Expand Up @@ -250,7 +250,7 @@ pub(crate) async fn execute_call<L: Logger>(req: Request<'_>, call: CallData<'_,
}
MethodCallback::Subscription(_) | MethodCallback::Unsubscription(_) => {
logger.on_call(name, params.clone(), logger::MethodKind::Unknown, TransportProtocol::Http);
tracing::error!("Subscriptions not supported on HTTP");
tracing::warn!("Subscriptions not supported on HTTP");
MethodResponse::error(id, ErrorObject::from(ErrorCode::InternalError))
}
},
Expand Down
4 changes: 2 additions & 2 deletions types/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl<'a> ParamsSequence<'a> {
b'[' | b',' => json = &json[1..],
_ => {
let errmsg = format!("Invalid params. Expected one of '[', ']' or ',' but found {json:?}");
tracing::error!("[next_inner] {}", errmsg);
tracing::trace!("[next_inner] {}", errmsg);
return Some(Err(invalid_params(errmsg)));
}
}
Expand All @@ -193,7 +193,7 @@ impl<'a> ParamsSequence<'a> {
Some(Ok(value))
}
Err(e) => {
tracing::error!(
tracing::trace!(
"[next_inner] Deserialization to {:?} failed. Error: {:?}, input JSON: {:?}",
std::any::type_name::<T>(),
e,
Expand Down