rust-nex/rnex-core/src/common.rs
Maple Nebel 7dd502aa7a
All checks were successful
Build and Test / fast-racing-neo (push) Successful in 16m31s
Build and Test / splatoon (push) Successful in 17m7s
Build and Test / puyopuyo (push) Successful in 17m7s
Build and Test / mario-tennis (push) Successful in 17m17s
Build and Test / minecraft-wiiu (push) Successful in 17m20s
Build and Test / wii-u-chat (push) Successful in 17m20s
Build and Test / splatoon-testfire (push) Successful in 17m23s
Build and Test / wii-sports-club (push) Successful in 17m25s
Build and Test / super-mario-maker (push) Successful in 21m26s
Build and Test / sonic-transformed (push) Successful in 28m35s
Build and Test / friends (push) Successful in 29m31s
start implementing sentry propperly
2026-07-09 04:17:05 +02:00

48 lines
1.3 KiB
Rust

use std::borrow::Cow;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
pub fn rnex_release() -> String {
let edition_piece = if let Some(e) = option_env!("EDITION") {
format!("{}", e)
} else {
env!("FEATURESET").into()
};
format!(
"rnex {} v{}({})",
edition_piece,
env!("CARGO_PKG_VERSION"),
env!("GIT_HASH")
)
}
pub async fn with_setup(f: impl AsyncFnOnce()) {
println!("setting up logger and dotenv");
dotenv::dotenv().ok();
let _maybe_sentry = if let Ok(sentry_url) = std::env::var("SENTRY_URL") {
Some(sentry::init((
sentry_url,
sentry::ClientOptions {
release: Some(Cow::Owned(rnex_release())),
send_default_pii: true,
..Default::default()
},
)))
} else {
None
};
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer())
.with(sentry::integrations::tracing::layer())
.try_init()
.expect("failed to init tracing subscriber");
f().await;
/*ctrlc::set_handler(||{
FORCE_EXIT.call_once_force(|_|{
println!("attempting exit");
});
}).unwrap();*/
}