More logging

This commit is contained in:
Edward Shen 2021-05-27 19:24:54 -04:00
parent 5536f9638a
commit 1c8f3da8d0
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 5 additions and 4 deletions

5
src/cache/fs.rs vendored
View file

@ -106,8 +106,8 @@ pub(super) async fn read_file(
// else, just directly read from file.
if let Some(key) = ENCRYPTION_KEY.get() {
let mut header_bytes = [0; HEADERBYTES];
if file.read_exact(&mut header_bytes).await.is_err() {
warn!("Found file, but encrypted header was not found. Assuming corrupted!");
if let Err(e) = file.read_exact(&mut header_bytes).await {
warn!("Found file but failed reading header: {}", e);
return None;
}
@ -158,6 +158,7 @@ pub(super) async fn read_file(
parsed_metadata.map(|metadata| Ok((stream, maybe_header, metadata)))
} else {
debug!("Reader was invalid, file is corrupt");
None
}
}

View file

@ -12,7 +12,7 @@ use base64::DecodeError;
use bytes::Bytes;
use chrono::{DateTime, Utc};
use futures::{Stream, TryStreamExt};
use log::{debug, error, info, warn};
use log::{debug, error, info, trace, warn};
use once_cell::sync::Lazy;
use prometheus::{Encoder, TextEncoder};
use reqwest::{Client, StatusCode};
@ -347,7 +347,7 @@ fn construct_response(
data: impl Stream<Item = Result<Bytes, UpstreamError>> + Unpin + 'static,
metadata: &ImageMetadata,
) -> ServerResponse {
debug!("Constructing response");
trace!("Constructing response");
let mut resp = HttpResponse::Ok();
if let Some(content_type) = metadata.content_type {