pub mod error;
pub mod logging;
pub mod plugin;
pub mod state;
pub mod transaction;
pub use state::{State, StateConfig, Configuration};
pub use transaction::Transaction;
pub use tracing::{info, debug, warn, error};
pub fn init_logging(
level: &str,
file_path: Option<&str>,
) -> anyhow::Result<()> {
use std::path::PathBuf;
let level = match level.to_lowercase().as_str() {
"trace" => tracing::Level::TRACE,
"debug" => tracing::Level::DEBUG,
"info" => tracing::Level::INFO,
"warn" => tracing::Level::WARN,
"error" => tracing::Level::ERROR,
_ => tracing::Level::INFO,
};
let file_path = file_path.map(PathBuf::from);
logging::init_logging(Some(level), file_path)
}