add structured logging
This commit is contained in:
+12
-9
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user