@ -151,11 +151,13 @@ impl Fairing for BetterLogging {
if ! self . 0 & & method = = Method ::Options {
if ! self . 0 & & method = = Method ::Options {
return ;
return ;
}
}
let mut uri = request . uri ( ) . to_string ( ) ;
let uri = request . uri ( ) ;
uri . truncate ( 50 ) ;
let uri_path = uri . path ( ) ;
if self . 0 | | LOGGED_ROUTES . iter ( ) . any ( | r | uri_path . starts_with ( r ) ) {
if self . 0 | | LOGGED_ROUTES . iter ( ) . any ( | r | uri . starts_with ( r ) ) {
match uri . query ( ) {
info ! ( target : "request" , "{} {}" , method , uri ) ;
Some ( q ) = > info ! ( target : "request" , "{} {}?{}" , method , uri_path , & q [ .. q . len ( ) . min ( 30 ) ] ) ,
None = > info ! ( target : "request" , "{} {}" , method , uri_path ) ,
} ;
}
}
}
}
@ -163,8 +165,8 @@ impl Fairing for BetterLogging {
if ! self . 0 & & request . method ( ) = = Method ::Options {
if ! self . 0 & & request . method ( ) = = Method ::Options {
return ;
return ;
}
}
let uri = request . uri ( ) . to_string ( ) ;
let uri _path = request . uri ( ) . path ( ) ;
if self . 0 | | LOGGED_ROUTES . iter ( ) . any ( | r | uri . starts_with ( r ) ) {
if self . 0 | | LOGGED_ROUTES . iter ( ) . any ( | r | uri _path . starts_with ( r ) ) {
let status = response . status ( ) ;
let status = response . status ( ) ;
if let Some ( ref route ) = request . route ( ) {
if let Some ( ref route ) = request . route ( ) {
info ! ( target : "response" , "{} => {} {}" , route , status . code , status . reason )
info ! ( target : "response" , "{} => {} {}" , route , status . code , status . reason )