completely refactor the backend
This commit is contained in:
96
backend/src/lib/outbound/notifier_debug_logger.rs
Normal file
96
backend/src/lib/outbound/notifier_debug_logger.rs
Normal file
@@ -0,0 +1,96 @@
|
||||
use crate::domain::{
|
||||
file_system::{
|
||||
models::file::{File, FilePath},
|
||||
ports::FileSystemNotifier,
|
||||
},
|
||||
warren::{models::warren::Warren, ports::WarrenNotifier},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct NotifierDebugLogger;
|
||||
|
||||
impl NotifierDebugLogger {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl WarrenNotifier for NotifierDebugLogger {
|
||||
async fn warrens_listed(&self, warrens: &Vec<Warren>) {
|
||||
log::debug!("[Notifier] Listed {} warren(s)", warrens.len());
|
||||
}
|
||||
|
||||
async fn warren_fetched(&self, warren: &Warren) {
|
||||
log::debug!("[Notifier] Fetched warren {}", warren.name());
|
||||
}
|
||||
|
||||
async fn warren_files_listed(&self, warren: &Warren, files: &Vec<File>) {
|
||||
log::debug!(
|
||||
"[Notifier] Listed {} file(s) in warren {}",
|
||||
files.len(),
|
||||
warren.name()
|
||||
);
|
||||
}
|
||||
|
||||
async fn warren_directory_created(&self, warren: &Warren, path: &FilePath) {
|
||||
log::debug!(
|
||||
"[Notifier] Created directory {} in warren {}",
|
||||
path,
|
||||
warren.name()
|
||||
);
|
||||
}
|
||||
|
||||
async fn warren_directory_deleted(&self, warren: &Warren, path: &FilePath) {
|
||||
log::debug!(
|
||||
"[Notifier] Deleted directory {} in warren {}",
|
||||
path,
|
||||
warren.name()
|
||||
);
|
||||
}
|
||||
|
||||
async fn warren_file_uploaded(&self, warren: &Warren, path: &FilePath) {
|
||||
log::debug!(
|
||||
"[Notifier] Uploaded file {} to warren {}",
|
||||
path,
|
||||
warren.name()
|
||||
);
|
||||
}
|
||||
|
||||
async fn warren_files_uploaded(&self, warren: &Warren, paths: &[FilePath]) {
|
||||
log::debug!(
|
||||
"[Notifier] Uploaded {} file(s) to warren {}",
|
||||
paths.len(),
|
||||
warren.name()
|
||||
);
|
||||
}
|
||||
|
||||
async fn warren_file_deleted(&self, warren: &Warren, path: &FilePath) {
|
||||
log::debug!(
|
||||
"[Notifier] Deleted file {} from warren {}",
|
||||
path,
|
||||
warren.name(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl FileSystemNotifier for NotifierDebugLogger {
|
||||
async fn files_listed(&self, files: &Vec<File>) {
|
||||
log::debug!("[Notifier] Listed {} file(s)", files.len());
|
||||
}
|
||||
|
||||
async fn directory_created(&self, path: &FilePath) {
|
||||
log::debug!("[Notifier] Created directory {}", path);
|
||||
}
|
||||
|
||||
async fn directory_deleted(&self, path: &FilePath) {
|
||||
log::debug!("[Notifier] Deleted directory {}", path);
|
||||
}
|
||||
|
||||
async fn file_created(&self, path: &FilePath) {
|
||||
log::debug!("[Notifier] Created file {}", path);
|
||||
}
|
||||
|
||||
async fn file_deleted(&self, path: &FilePath) {
|
||||
log::debug!("[Notifier] Deleted file {}", path);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user