main.rs
raw
use clap::Parser;
use mugit::{App, Config};
use tracing_subscriber::EnvFilter;
// What is logged unless MUGIT_LOG says otherwise: a development build
// narrates, a release build only reports trouble.
const DEFAULT_LOG: &str = if cfg!(debug_assertions) {
"info"
} else {
"warn"
};
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
let filter =
EnvFilter::try_from_env("MUGIT_LOG").unwrap_or_else(|_| EnvFilter::new(DEFAULT_LOG));
tracing_subscriber::fmt().with_env_filter(filter).init();
let config = Config::parse();
tracing::info!(repos = %config.repos.display(), "starting mugit");
let app = App::new(config)?;
mugit::serve::run(app).await
}