use std::{
time::Duration,
path::PathBuf,
};
pub enum LogConfig {
Path(LogPath),
Rotator(LogRotatorConfig),
}
pub enum LogPath {
Path(PathBuf),
}
pub struct LogRotatorConfig {
pub log_path: PathBuf,
pub max_size: u64,
pub max_time: Duration,
}
impl LogRotatorConfig {
pub fn new(log_path: PathBuf, max_size: u64, max_time: Duration) -> Self {
Self {
log_path,
max_size,
max_time,
}
}
}
impl From<&str> for LogPath {
fn from(s: &str) -> Self {
Self::Path(PathBuf::from(s))
}
}
impl From<PathBuf> for LogPath {
fn from(path: PathBuf) -> Self {
Self::Path(path)
}
}