about summary refs log tree commit diff
path: root/kittybox-rs/src/database
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-07-27 11:14:04 +0300
committerVika <vika@fireburn.ru>2022-07-27 11:14:04 +0300
commitd47c536f973f48d35081c4dbbfbd2b13394d9aa7 (patch)
treec5bcef3ffe70eff52faff026f73338b97cb93695 /kittybox-rs/src/database
parente88b656a7bd4e87d431249b37db75dec5ecc4e85 (diff)
downloadkittybox-d47c536f973f48d35081c4dbbfbd2b13394d9aa7.tar.zst
kittybox-templates: split out MF2 rendering and get rid of log crate
Kittybox now uses tracing instead of log. Why would I keep an
unneccesary dependency in my Cargo.lock?
Diffstat (limited to 'kittybox-rs/src/database')
-rw-r--r--kittybox-rs/src/database/file/mod.rs8
-rw-r--r--kittybox-rs/src/database/mod.rs2
2 files changed, 5 insertions, 5 deletions
diff --git a/kittybox-rs/src/database/file/mod.rs b/kittybox-rs/src/database/file/mod.rs
index f83e682..bafb7bf 100644
--- a/kittybox-rs/src/database/file/mod.rs
+++ b/kittybox-rs/src/database/file/mod.rs
@@ -9,7 +9,7 @@ use std::path::{Path, PathBuf};
 use tokio::fs::{File, OpenOptions};
 use tokio::io::{AsyncReadExt, AsyncWriteExt};
 use tokio::task::spawn_blocking;
-use tracing::debug;
+use tracing::{debug, error};
 
 impl From<std::io::Error> for StorageError {
     fn from(source: std::io::Error) -> Self {
@@ -250,7 +250,7 @@ async fn hydrate_author<S: Storage>(
                                 None => json!(i),
                             },
                             Err(e) => {
-                                log::error!("Error while hydrating post {}: {}", url, e);
+                                error!("Error while hydrating post {}: {}", url, e);
                                 json!(i)
                             }
                         }
@@ -583,14 +583,14 @@ impl Storage for FileStorage {
 
     #[tracing::instrument(skip(self))]
     async fn get_setting(&self, setting: Settings, user: &'_ str) -> Result<String> {
-        log::debug!("User for getting settings: {}", user);
+        debug!("User for getting settings: {}", user);
         let url = axum::http::Uri::try_from(user).expect("Couldn't parse a URL");
         let mut path = relative_path::RelativePathBuf::new();
         path.push(url.authority().unwrap().to_string());
         path.push("settings");
 
         let path = path.to_path(&self.root_dir);
-        log::debug!("Getting settings from {:?}", &path);
+        debug!("Getting settings from {:?}", &path);
         let setting = setting.to_string();
         let mut file = File::open(path).await?;
         let mut content = String::new();
diff --git a/kittybox-rs/src/database/mod.rs b/kittybox-rs/src/database/mod.rs
index 10fbc72..9072d9d 100644
--- a/kittybox-rs/src/database/mod.rs
+++ b/kittybox-rs/src/database/mod.rs
@@ -544,8 +544,8 @@ mod tests {
     macro_rules! file_test {
         ($func_name:ident) => {
             #[tokio::test]
+            #[tracing_test::traced_test]
             async fn $func_name() {
-                test_logger::ensure_env_logger_initialized();
                 let tempdir = tempdir::TempDir::new("file").expect("Failed to create tempdir");
                 let backend = super::super::FileStorage::new(
                     tempdir.path().to_path_buf()