diff options
author | Katharina Fey <kookie@spacekookie.de> | 2021-02-07 16:44:44 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2021-02-07 16:44:44 +0100 |
commit | 79c8b9ab441493e3b3a37a59263f66896c9c90b3 (patch) | |
tree | ca111686fa202369a5730ff8151480b04e391cbb /games/rstnode/rst-client/src/log.rs | |
parent | f5b36ff6b99256030201c878608a07d163b4c802 (diff) |
rstnode: basic asset loading and prototype sprite rendering
* restructure assets directory
* implement asset loading and dynamic conversion to sprites
* reload sprites with unique URIs to load at runtime
* provide an updated renderer API to give access to client state
* use new APIs to draw a single node frame on screen
* use colour APIs to dynamically change node frame colour
Diffstat (limited to 'games/rstnode/rst-client/src/log.rs')
-rw-r--r-- | games/rstnode/rst-client/src/log.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/games/rstnode/rst-client/src/log.rs b/games/rstnode/rst-client/src/log.rs new file mode 100644 index 000000000000..f1c346ae343a --- /dev/null +++ b/games/rstnode/rst-client/src/log.rs @@ -0,0 +1,43 @@ +//! 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) + }) +} |