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