hyperi-rustlib
Shared utility library for HyperI Rust applications.
Provides configuration management, structured logging, Prometheus metrics,
and environment detection - matching the functionality of hyperi-pylib (Python)
and hyperi-golib (Go).
Quick Start
use hyperi_rustlib::{env, config, logger, metrics};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let environment = env::Environment::detect();
println!("Running in: {:?}", environment);
logger::setup_default()?;
config::setup(config::ConfigOptions {
env_prefix: "MYAPP".into(),
..Default::default()
})?;
let cfg = config::get();
let db_host = cfg.get_string("database.host").unwrap_or_default();
let metrics_mgr = metrics::MetricsManager::new("myapp");
let _counter = metrics_mgr.counter("requests_total", "Total requests processed");
tracing::info!(db_host = %db_host, "Application started");
Ok(())
}