add structured logging

This commit is contained in:
2026-08-18 21:28:48 +01:00
parent 4f3995da17
commit 2879fecf70
8 changed files with 233 additions and 101 deletions
+12 -9
View File
@@ -31,15 +31,12 @@ impl Default for Config {
impl Config {
pub fn load(path: &Path) -> anyhow::Result<Self> {
if path.exists() {
let contents = std::fs::read_to_string(path)?;
let config: Config = serde_json::from_str(&contents)?;
tracing::info!("Loaded config from {}", path.display());
Ok(config)
} else {
tracing::warn!("Config file {} not found, using defaults", path.display());
Ok(Self::default())
}
let contents = std::fs::read_to_string(path)
.map_err(|e| anyhow::anyhow!("Failed to read config file {}: {e}", path.display()))?;
let config: Config = serde_json::from_str(&contents)
.map_err(|e| anyhow::anyhow!("Failed to parse config file {}: {e}", path.display()))?;
tracing::info!("Loaded config from {}", path.display());
Ok(config)
}
}
@@ -179,6 +176,12 @@ pub struct SpeciesDto {
pub label: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LookupDto {
pub code: String,
pub label: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LandingDto {
pub month: String,