Skip to content

Commit

Permalink
Log HTTP Not Found (404) as info log level. (kanidm#3119)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbw authored Oct 19, 2024
1 parent 68119e1 commit a0944b8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/core/src/https/trace.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Reimplementation of tower-http's DefaultMakeSpan that only runs at "INFO" level for our own needs.
use axum::http::Request;
use axum::http::{Request, StatusCode};
use kanidm_proto::constants::KOPID;
use sketching::event_dynamic_lvl;
use tower_http::LatencyUnit;
Expand Down Expand Up @@ -83,7 +83,11 @@ impl<B> tower_http::trace::OnResponse<B> for DefaultOnResponseKanidmd {
if response.status().is_redirection() {
(Level::INFO, "client redirection sent")
} else if response.status().is_client_error() {
(Level::WARN, "client error") // it worked, but there was an input error
if response.status() == StatusCode::NOT_FOUND {
(Level::INFO, "client error")
} else {
(Level::WARN, "client error") // it worked, but there was an input error
}
} else {
(Level::ERROR, "error handling request") // oh no the server failed
}
Expand Down

0 comments on commit a0944b8

Please sign in to comment.