mirror of
https://github.com/dani-garcia/vaultwarden
synced 2024-11-23 12:23:04 +00:00
Also hide options requests, unless using debug or trace
This commit is contained in:
parent
8d1b72b951
commit
a03db6d224
1 changed files with 8 additions and 1 deletions
|
@ -147,15 +147,22 @@ impl Fairing for BetterLogging {
|
|||
}
|
||||
|
||||
fn on_request(&self, request: &mut Request<'_>, _data: &Data) {
|
||||
let method = request.method();
|
||||
if !self.0 && method == Method::Options {
|
||||
return;
|
||||
}
|
||||
let mut uri = request.uri().to_string();
|
||||
uri.truncate(50);
|
||||
|
||||
if self.0 || LOGGED_ROUTES.iter().any(|r| uri.starts_with(r)) {
|
||||
info!(target: "request", "{} {}", request.method(), uri);
|
||||
info!(target: "request", "{} {}", method, uri);
|
||||
}
|
||||
}
|
||||
|
||||
fn on_response(&self, request: &Request, response: &mut Response) {
|
||||
if !self.0 && request.method() == Method::Options {
|
||||
return;
|
||||
}
|
||||
let uri = request.uri().to_string();
|
||||
if self.0 || LOGGED_ROUTES.iter().any(|r| uri.starts_with(r)) {
|
||||
let status = response.status();
|
||||
|
|
Loading…
Reference in a new issue