Migrate to structured logging

This commit is contained in:
micialware committed 2026-08-23 22:48:00 +03:00
1 parent 0367d5001b
commit 0baf6cadf7
13 files changed
+202 -30

No files matched your search

+4 -3
View File
@@ -1,5 +1,6 @@
use crate::notification::NotificationData;
use hashbrown::HashMap;
use log::info;
use rusqlite::Connection;
use serde_json::Value;
@@ -53,7 +54,7 @@ pub fn load_groups(connection: &Connection) -> Result<ImportData, NotificationDa
.map(|x| x.as_str().unwrap().to_string())
.collect();
let id = collection.get("id");
if id.is_none() {
if id.is_none() {
return Err(NotificationData::IncorrectAnkiFile);
}
let id = id.unwrap().as_u64().unwrap();
@@ -62,7 +63,7 @@ pub fn load_groups(connection: &Connection) -> Result<ImportData, NotificationDa
return Err(NotificationData::IncorrectAnkiFile);
}
let name = name.unwrap().as_str().unwrap().to_string();
let mut group = ImportGroup {
id,
name,
@@ -74,7 +75,7 @@ pub fn load_groups(connection: &Connection) -> Result<ImportData, NotificationDa
if let Some((_, count)) = counts.iter().find(|(id, _)| *id == group.id as i64) {
group.length = *count as u64
}
println!("{:?}", group);
info!("{:?}", group);
total_data.0.push(group);
}
}