diff options
author | Katharina Fey <kookie@spacekookie.de> | 2021-02-14 00:06:14 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2021-02-14 00:06:14 +0100 |
commit | effbdeed66e8de8e769b8ac069926ad1a9110e62 (patch) | |
tree | e4522354e53266204aa9962caccde55d8c815092 /games/rstnode/rst-server/src/log.rs | |
parent | 5dab336049dbc6817e9ff212998690f59f6bbfa8 (diff) |
* Add an inbox/ outbox system to server components
* Define a data flow from Request -> computation -> Update
* Create simple handlers to call server or client code for requests
Diffstat (limited to 'games/rstnode/rst-server/src/log.rs')
-rw-r--r-- | games/rstnode/rst-server/src/log.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/games/rstnode/rst-server/src/log.rs b/games/rstnode/rst-server/src/log.rs index 62d03167bb7a..676395134a59 100644 --- a/games/rstnode/rst-server/src/log.rs +++ b/games/rstnode/rst-server/src/log.rs @@ -8,8 +8,15 @@ const BANNER: &'static str = " ██║ ██║███████║ ██║ ██║ ╚████║╚██████╔╝██████╔╝███████╗ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝"; +use systemstat::{Platform, System}; use tracing_subscriber::{filter::LevelFilter, fmt, EnvFilter}; +#[cfg(not(target_os = "windows"))] +const PLATFORM_DISCLAIMER: &'static str = "Platform: Unspecified *nix-like"; +#[cfg(target_os = "windows")] +static PLATFORM_DISCLAIMER: &'static str = + "WARNING: Windows server hosts are not officially supported!"; + pub(crate) fn initialise() { let filter = EnvFilter::try_from_env("RST_LOG") .unwrap_or_default() @@ -19,13 +26,24 @@ pub(crate) fn initialise() { // Initialise the logger fmt().with_env_filter(filter).init(); - info!("Initialising server..."); + info!("Initialising..."); info!("{}", BANNER); - info!("Available cores: unknown"); - info!("Available RAM: unknown"); + info!("{}", PLATFORM_DISCLAIMER); + info!("Available cores: {}", num_cpus::get()); + info!("Available RAM: {}", mem()); info!("Version: {}", crate::constants::VERSION); } +fn mem() -> String { + let sys = System::new(); + let mem = sys.memory().unwrap(); + format!( + "{} / {}", + mem.free.to_string_as(true), + mem.total.to_string_as(true) + ) +} + #[macro_export] macro_rules! fatal { () => { |