122 lines
3.3 KiB
Rust
122 lines
3.3 KiB
Rust
use crate::domain::warren::{
|
|
models::{
|
|
file::{File, FilePath},
|
|
user::User,
|
|
warren::Warren,
|
|
},
|
|
ports::{AuthNotifier, FileSystemNotifier, 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>) {
|
|
tracing::debug!("[Notifier] Listed {} warren(s)", warrens.len());
|
|
}
|
|
|
|
async fn warren_fetched(&self, warren: &Warren) {
|
|
tracing::debug!("[Notifier] Fetched warren {}", warren.name());
|
|
}
|
|
|
|
async fn warren_files_listed(&self, warren: &Warren, files: &Vec<File>) {
|
|
tracing::debug!(
|
|
"[Notifier] Listed {} file(s) in warren {}",
|
|
files.len(),
|
|
warren.name()
|
|
);
|
|
}
|
|
|
|
async fn warren_directory_created(&self, warren: &Warren, path: &FilePath) {
|
|
tracing::debug!(
|
|
"[Notifier] Created directory {} in warren {}",
|
|
path,
|
|
warren.name()
|
|
);
|
|
}
|
|
|
|
async fn warren_directory_deleted(&self, warren: &Warren, path: &FilePath) {
|
|
tracing::debug!(
|
|
"[Notifier] Deleted directory {} in warren {}",
|
|
path,
|
|
warren.name()
|
|
);
|
|
}
|
|
|
|
async fn warren_file_uploaded(&self, warren: &Warren, path: &FilePath) {
|
|
tracing::debug!(
|
|
"[Notifier] Uploaded file {} to warren {}",
|
|
path,
|
|
warren.name()
|
|
);
|
|
}
|
|
|
|
async fn warren_files_uploaded(&self, warren: &Warren, paths: &[FilePath]) {
|
|
tracing::debug!(
|
|
"[Notifier] Uploaded {} file(s) to warren {}",
|
|
paths.len(),
|
|
warren.name()
|
|
);
|
|
}
|
|
|
|
async fn warren_file_deleted(&self, warren: &Warren, path: &FilePath) {
|
|
tracing::debug!(
|
|
"[Notifier] Deleted file {} from warren {}",
|
|
path,
|
|
warren.name(),
|
|
);
|
|
}
|
|
|
|
async fn warren_entry_renamed(
|
|
&self,
|
|
warren: &Warren,
|
|
old_path: &crate::domain::warren::models::file::AbsoluteFilePath,
|
|
new_path: &FilePath,
|
|
) {
|
|
tracing::debug!(
|
|
"[Notifier] Renamed file {} to {} in warren {}",
|
|
old_path,
|
|
new_path,
|
|
warren.name(),
|
|
);
|
|
}
|
|
}
|
|
|
|
impl FileSystemNotifier for NotifierDebugLogger {
|
|
async fn files_listed(&self, files: &Vec<File>) {
|
|
tracing::debug!("[Notifier] Listed {} file(s)", files.len());
|
|
}
|
|
|
|
async fn directory_created(&self, path: &FilePath) {
|
|
tracing::debug!("[Notifier] Created directory {}", path);
|
|
}
|
|
|
|
async fn directory_deleted(&self, path: &FilePath) {
|
|
tracing::debug!("[Notifier] Deleted directory {}", path);
|
|
}
|
|
|
|
async fn file_created(&self, path: &FilePath) {
|
|
tracing::debug!("[Notifier] Created file {}", path);
|
|
}
|
|
|
|
async fn file_deleted(&self, path: &FilePath) {
|
|
tracing::debug!("[Notifier] Deleted file {}", path);
|
|
}
|
|
|
|
async fn entry_renamed(&self, old_path: &FilePath, new_path: &FilePath) {
|
|
tracing::debug!("[Notifier] Renamed file {} to {}", old_path, new_path);
|
|
}
|
|
}
|
|
|
|
impl AuthNotifier for NotifierDebugLogger {
|
|
async fn user_registered(&self, user: &User) {
|
|
tracing::debug!("[Notifier] Registered user {}", user.name());
|
|
}
|
|
}
|