added get latest image function

This commit is contained in:
lkoester
2024-04-25 16:31:05 +02:00
parent df556acbf5
commit 2566050b3b
4 changed files with 75 additions and 36 deletions

View File

@ -1,6 +1,6 @@
use std::path::{Path, PathBuf};
use once_cell::sync::OnceCell;
use ops_sat_rs::config::LOG_FOLDER;
use std::path::{Path, PathBuf};
pub static LOGFILE_PATH: OnceCell<PathBuf> = OnceCell::new();
@ -9,9 +9,17 @@ pub fn setup_logger() -> Result<(), fern::InitError> {
eprintln!("Failed to create log folder '{}'", LOG_FOLDER);
}
let mut path_buf = PathBuf::from(LOG_FOLDER);
path_buf.push(format!("output_{}.log", humantime::format_rfc3339_seconds(std::time::SystemTime::now()).to_string()).replace(":", "_"));
path_buf.push(
format!(
"output_{}.log",
humantime::format_rfc3339_seconds(std::time::SystemTime::now()).to_string()
)
.replace(":", "_"),
);
println!("Creating logfile {:?}", path_buf);
LOGFILE_PATH.set(path_buf.clone()).expect("Error setting global logfile path");
LOGFILE_PATH
.set(path_buf.clone())
.expect("Error setting global logfile path");
fern::Dispatch::new()
.format(move |out, message, record| {
out.finish(format_args!(