add functionality to show log

This commit is contained in:
2023-10-28 14:48:08 +02:00
parent cfd0ccc8c2
commit 08a1d16f88
4 changed files with 29 additions and 9 deletions

View File

@ -51,4 +51,16 @@ LIMIT 1000
ret.push_str("</rss>");
ret.replace('\n', "")
}
pub async fn show(db: &SqlitePool) -> String {
let mut ret = String::new();
for log in Self::last(db).await {
let utc_time: DateTime<Utc> = Utc::from_utc_datetime(&Utc, &log.created_at);
let local_time = utc_time.with_timezone(&Local);
ret.push_str(&format!("- {} - {}\n", local_time, log.msg));
}
ret
}
}