My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/games/rstnode/rst-client/src/log.rs

43 lines
2.0 KiB

//! Logging specifics
const BANNER: &'static str = "
██████╗ ███████╗████████╗ ███╗ ██╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔════╝╚══██╔══╝ ████╗ ██║██╔═══██╗██╔══██╗██╔════╝
██████╔╝███████╗ ██║ ██╔██╗ ██║██║ ██║██║ ██║█████╗
██╔══██╗╚════██║ ██║ ██║╚██╗██║██║ ██║██║ ██║██╔══╝
██║ ██║███████║ ██║ ██║ ╚████║╚██████╔╝██████╔╝███████╗
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝";
use tracing_subscriber::{filter::LevelFilter, fmt, EnvFilter};
pub(crate) fn initialise() {
let filter = EnvFilter::try_from_env("RST_LOG")
.unwrap_or_default()
.add_directive(LevelFilter::DEBUG.into())
.add_directive("async_std=error".parse().unwrap())
.add_directive("gfx_device_gl=error".parse().unwrap())
.add_directive("ggez=error".parse().unwrap())
.add_directive("selectors=error".parse().unwrap())
.add_directive("gilrs=error".parse().unwrap())
.add_directive("mio=error".parse().unwrap());
// Initialise the logger
fmt().with_env_filter(filter).init();
info!("Initialising...");
info!("{}", BANNER);
info!("Platform: unknown");
info!("GPU Driver: unknown");
info!("Version: {}", crate::constants::VERSION);
}
#[macro_export]
macro_rules! fatal {
() => {
error!("Unknown failure!");
std::process::exit(2)
};
($($arg:tt)*) => ({
error!($($arg)*);
std::process::exit(2)
})
}