From 0e7e799bd463542516ba8710be53ece6dd20ef24 Mon Sep 17 00:00:00 2001 From: dowwie Date: Wed, 10 Apr 2019 14:43:55 -0400 Subject: [PATCH] added request path to debug logs --- src/data.rs | 3 ++- src/types/json.rs | 5 ++++- src/types/path.rs | 5 +---- src/types/query.rs | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/data.rs b/src/data.rs index d7f6a5837..590b071a8 100644 --- a/src/data.rs +++ b/src/data.rs @@ -96,7 +96,8 @@ impl FromRequest

for Data { if let Some(st) = req.app_config().extensions().get::>() { Ok(st.clone()) } else { - log::debug!("Failed to construct App-level Data extractor"); + log::debug!("Failed to construct App-level Data extractor. \ + Request path: {:?}", req.path()); Err(ErrorInternalServerError( "App data is not configured, to configure use App::data()", )) diff --git a/src/types/json.rs b/src/types/json.rs index f8394244b..1c5171407 100644 --- a/src/types/json.rs +++ b/src/types/json.rs @@ -179,11 +179,14 @@ where .map(|c| (c.limit, c.ehandler.clone())) .unwrap_or((32768, None)); + let path = req.path().to_string(); + Box::new( JsonBody::new(req, payload) .limit(limit) .map_err(move |e| { - log::debug!("Failed to deserialize Json from payload"); + log::debug!("Failed to deserialize Json from payload. \ + Request path: {:?}", path); if let Some(err) = err { (*err)(e, &req2) } else { diff --git a/src/types/path.rs b/src/types/path.rs index 609994e65..d8334679a 100644 --- a/src/types/path.rs +++ b/src/types/path.rs @@ -163,10 +163,7 @@ where fn from_request(req: &HttpRequest, _: &mut Payload

) -> Self::Future { de::Deserialize::deserialize(PathDeserializer::new(req.match_info())) .map(|inner| Path { inner }) - .map_err(|| { - log::debug!("Failed to deserialize during Path extractor"); - ErrorNotFound - }) + .map_err(ErrorNotFound) } } diff --git a/src/types/query.rs b/src/types/query.rs index 5fd6012fe..363d56199 100644 --- a/src/types/query.rs +++ b/src/types/query.rs @@ -123,7 +123,8 @@ where serde_urlencoded::from_str::(req.query_string()) .map(|val| Ok(Query(val))) .unwrap_or_else(|e| { - log::debug!("Failed during Query extractor deserialization"); + log::debug!("Failed during Query extractor deserialization. \ + Request path: {:?}", req.path()); Err(e.into()) }) }