change log dir option from toml to command line

This commit is contained in:
Jun Kurihara 2025-04-28 16:29:21 +09:00
commit f252959a2f
No known key found for this signature in database
GPG key ID: D992B3E3DE1DED23
8 changed files with 61 additions and 62 deletions

View file

@ -5,7 +5,12 @@ use tracing_subscriber::{fmt, prelude::*};
pub use tracing::{debug, error, info, warn};
/// Initialize the logger with the RUST_LOG environment variable.
pub fn init_logger() {
pub fn init_logger(log_dir_path: Option<&str>) {
if log_dir_path.is_some() {
// TODO:
println!("Activate logging to files")
}
let level_string = std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string());
let level = tracing::Level::from_str(level_string.as_str()).unwrap_or(tracing::Level::INFO);