#[cfg(feature = "dhat")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
#[cfg(all(feature = "jemalloc", not(feature = "dhat")))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
use anyhow::Result;
use clap::Parser;
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
fn main() -> Result<()> {
#[cfg(feature = "dhat")]
let _profiler = dhat::Profiler::new_heap();
let cli = repotoire::cli::Cli::parse();
let default_filter = cli.log_level.as_filter_str();
tracing_subscriber::registry()
.with(fmt::layer().with_writer(std::io::stderr))
.with(
EnvFilter::try_from_default_env()
.unwrap_or_else(|_| EnvFilter::new(default_filter)),
)
.init();
let telemetry = repotoire::telemetry::init()?;
let result = repotoire::cli::run(cli, telemetry);
repotoire::telemetry::posthog::flush();
result
}