diff options
author | Alex Auvolat <alex@adnab.me> | 2021-02-20 00:30:39 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-02-20 00:30:39 +0100 |
commit | 3bcbbe1e31e528e8d9648b0431a43f85e9496e58 (patch) | |
tree | 243f52489ed62990dd59c8a326ab6079ead24384 /src | |
parent | 10b983b8e7076b385f28f9c79cae19882b1db951 (diff) | |
download | garage-3bcbbe1e31e528e8d9648b0431a43f85e9496e58.tar.gz garage-3bcbbe1e31e528e8d9648b0431a43f85e9496e58.zip |
More precise logging (warn only when returning a 500)
Diffstat (limited to 'src')
-rw-r--r-- | src/api/api_server.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/api_server.rs b/src/api/api_server.rs index 92a64418..c3e205ab 100644 --- a/src/api/api_server.rs +++ b/src/api/api_server.rs @@ -62,7 +62,11 @@ async fn handler( let body: Body = Body::from(format!("{}\n", e)); let mut http_error = Response::new(body); *http_error.status_mut() = e.http_status_code(); - warn!("Response: error {}, {}", e.http_status_code(), e); + if e.http_status_code().is_server_error() { + warn!("Response: error {}, {}", e.http_status_code(), e); + } else { + info!("Response: error {}, {}", e.http_status_code(), e); + } Ok(http_error) } } |