added request path to debug logs

This commit is contained in:
dowwie 2019-04-10 14:43:55 -04:00
parent 693f6ef541
commit 0e7e799bd4
4 changed files with 9 additions and 7 deletions

View File

@ -96,7 +96,8 @@ impl<T: 'static, P> FromRequest<P> for Data<T> {
if let Some(st) = req.app_config().extensions().get::<Data<T>>() {
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()",
))

View File

@ -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 {

View File

@ -163,10 +163,7 @@ where
fn from_request(req: &HttpRequest, _: &mut Payload<P>) -> 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)
}
}

View File

@ -123,7 +123,8 @@ where
serde_urlencoded::from_str::<T>(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())
})
}