1pub mod logging;
2pub mod model;
3pub mod state;
4pub mod transform;
5
6pub use tracing::{info, debug, warn, error};
7
8pub fn init_logging(
30 level: &str,
31 file_path: Option<&str>,
32) -> anyhow::Result<()> {
33 use std::path::PathBuf;
34
35 let level = match level.to_lowercase().as_str() {
36 "trace" => tracing::Level::TRACE,
37 "debug" => tracing::Level::DEBUG,
38 "info" => tracing::Level::INFO,
39 "warn" => tracing::Level::WARN,
40 "error" => tracing::Level::ERROR,
41 _ => tracing::Level::INFO,
42 };
43
44 let file_path = file_path.map(PathBuf::from);
45 logging::init_logging(Some(level), file_path)
46}