Implement log levels
This commit is contained in:
parent
2cdf68082a
commit
874cac2df1
25 changed files with 497 additions and 223 deletions
|
|
@ -13,6 +13,7 @@ use crate::{
|
|||
/// Will panic if file read fails.
|
||||
#[expect(clippy::unused_async)]
|
||||
pub async fn file(file_path: &str, content_type: &str) -> Response<Body> {
|
||||
let instant = now();
|
||||
let content = match std::fs::read(file_path) {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
|
|
@ -27,9 +28,16 @@ pub async fn file(file_path: &str, content_type: &str) -> Response<Body> {
|
|||
if let Ok(header_value) = HeaderValue::from_str(content_type) {
|
||||
response.headers_mut().append(header, header_value);
|
||||
} else {
|
||||
log!("Failed to create content type header value from {content_type}");
|
||||
log!(
|
||||
WARN,
|
||||
"Failed to create content type header value from {content_type}"
|
||||
);
|
||||
}
|
||||
|
||||
tlog!(
|
||||
&instant,
|
||||
"Assembled response for {content_type} {file_path}"
|
||||
);
|
||||
response
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue