v2 #2
1 changed files with 5 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ use isahc::{
|
||||||
http::{Method, StatusCode, header},
|
http::{Method, StatusCode, header},
|
||||||
};
|
};
|
||||||
use secrecy::SecretString;
|
use secrecy::SecretString;
|
||||||
use tracing::{Level, debug, error};
|
use tracing::{Level, debug, error, info};
|
||||||
use tracing_subscriber::fmt::format::FmtSpan;
|
use tracing_subscriber::fmt::format::FmtSpan;
|
||||||
|
|
||||||
pub fn setup_logger(debug: bool) {
|
pub fn setup_logger(debug: bool) {
|
||||||
|
|
@ -105,8 +105,9 @@ impl Client {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(level = "info", skip(cache))]
|
#[tracing::instrument(level = "debug", skip(cache))]
|
||||||
pub fn save_cache(&self, key: &CacheKey, cache: Vec<u8>) -> Result<()> {
|
pub fn save_cache(&self, key: &CacheKey, cache: Vec<u8>) -> Result<()> {
|
||||||
|
info!(?key, "save cache");
|
||||||
let cache_len = cache.len();
|
let cache_len = cache.len();
|
||||||
let cache_id = self.reserve(key, cache_len).context("reserving cache")?;
|
let cache_id = self.reserve(key, cache_len).context("reserving cache")?;
|
||||||
|
|
||||||
|
|
@ -234,8 +235,9 @@ impl Client {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(level = "info")]
|
#[tracing::instrument(level = "debug")]
|
||||||
pub fn load_cache(&self, key: &CacheKey) -> Result<Option<Box<[u8]>>> {
|
pub fn load_cache(&self, key: &CacheKey) -> Result<Option<Box<[u8]>>> {
|
||||||
|
info!(?key, "load cache");
|
||||||
let Some(cache_location) = self.get_cache_entry(key).context("getting cache entry")? else {
|
let Some(cache_location) = self.get_cache_entry(key).context("getting cache entry")? else {
|
||||||
// cache miss
|
// cache miss
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue