Pre-alpha CI/CD release support
This commit is contained in:
@@ -24,7 +24,7 @@ pub struct InputBox<'a> {
|
||||
}
|
||||
|
||||
impl<'a> InputBox<'a> {
|
||||
pub fn new(content: &'a str) -> InputBox<'_> {
|
||||
pub fn new(content: &'a str) -> InputBox<'a> {
|
||||
InputBox {
|
||||
content,
|
||||
offset: 0,
|
||||
|
||||
+24
-2
@@ -1,3 +1,6 @@
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use log::LevelFilter;
|
||||
use log4rs::append::file::FileAppender;
|
||||
use log4rs::config::{Appender, Root};
|
||||
@@ -7,13 +10,32 @@ use log4rs::encode::pattern::PatternEncoder;
|
||||
#[path = "utils_tests.rs"]
|
||||
mod utils_tests;
|
||||
|
||||
pub fn get_log_path() -> PathBuf {
|
||||
let mut log_path = if cfg!(target_os = "linux") {
|
||||
dirs_next::cache_dir().unwrap_or_else(|| PathBuf::from("~/.cache"))
|
||||
} else if cfg!(target_os = "macos") {
|
||||
dirs_next::home_dir().unwrap().join("Library/Logs")
|
||||
} else {
|
||||
dirs_next::data_local_dir().unwrap_or_else(|| PathBuf::from("C:\\Logs"))
|
||||
};
|
||||
|
||||
log_path.push("managarr");
|
||||
|
||||
// Create the directory if it doesn't exist
|
||||
if let Err(e) = fs::create_dir_all(&log_path) {
|
||||
eprintln!("Failed to create log directory: {:?}", e);
|
||||
}
|
||||
|
||||
log_path.push("managarr.log");
|
||||
log_path
|
||||
}
|
||||
|
||||
pub fn init_logging_config() -> log4rs::Config {
|
||||
let file_path = "/tmp/managarr.log";
|
||||
let logfile = FileAppender::builder()
|
||||
.encoder(Box::new(PatternEncoder::new(
|
||||
"{d(%Y-%m-%d %H:%M:%S%.3f)(utc)} <{i}> [{l}] {f}:{L} - {m}{n}",
|
||||
)))
|
||||
.build(file_path)
|
||||
.build(get_log_path())
|
||||
.unwrap();
|
||||
|
||||
log4rs::Config::builder()
|
||||
|
||||
Reference in New Issue
Block a user