diff --git a/mediarepo-api/src/tauri_plugin/mod.rs b/mediarepo-api/src/tauri_plugin/mod.rs index 801a384..6436aa7 100644 --- a/mediarepo-api/src/tauri_plugin/mod.rs +++ b/mediarepo-api/src/tauri_plugin/mod.rs @@ -47,6 +47,7 @@ impl Plugin for MediarepoPlugin { "mediarepo" } + #[tracing::instrument(skip(self, app, _config))] fn initialize( &mut self, app: &AppHandle, diff --git a/mediarepo-api/src/tauri_plugin/settings.rs b/mediarepo-api/src/tauri_plugin/settings.rs index 0b7d164..8fbcc68 100644 --- a/mediarepo-api/src/tauri_plugin/settings.rs +++ b/mediarepo-api/src/tauri_plugin/settings.rs @@ -7,14 +7,14 @@ use std::path::PathBuf; static SETTINGS_FILE: &str = "settings.toml"; -#[derive(Serialize, Deserialize, Clone)] +#[derive(Serialize, Debug, Deserialize, Clone)] pub struct Repository { pub(crate) name: String, pub(crate) path: Option, pub(crate) address: String, } -#[derive(Default, Serialize, Deserialize)] +#[derive(Default, Debug, Serialize, Deserialize)] pub struct Settings { pub repositories: HashMap, } @@ -27,6 +27,7 @@ fn get_settings_path() -> PathBuf { } /// Writes the settings to the file +#[tracing::instrument(level = "debug")] pub fn save_settings(settings: &Settings) -> PluginResult<()> { let settings_path = get_settings_path(); let settings_string = toml::to_string(&settings)?; @@ -36,8 +37,10 @@ pub fn save_settings(settings: &Settings) -> PluginResult<()> { } /// Loads the settings from the file +#[tracing::instrument(level = "debug")] pub fn load_settings() -> PluginResult { - let dirs = ProjectDirs::from("com", "trivernis", "mediarepo").unwrap(); + let dirs = ProjectDirs::from("com", "trivernis", "mediarepo") + .expect("Failed to get project directories"); let config_path = dirs.config_dir().to_path_buf(); if !config_path.exists() { fs::create_dir_all(&config_path)?; diff --git a/mediarepo-api/src/tauri_plugin/state.rs b/mediarepo-api/src/tauri_plugin/state.rs index f23178e..6833f99 100644 --- a/mediarepo-api/src/tauri_plugin/state.rs +++ b/mediarepo-api/src/tauri_plugin/state.rs @@ -59,6 +59,7 @@ pub struct AppState { } impl AppState { + #[tracing::instrument(level = "debug")] pub fn load() -> PluginResult { let settings = load_settings()?;