diff --git a/Cargo.lock b/Cargo.lock index 9914df2..1b7c355 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,6 +65,7 @@ checksum = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" name = "core" version = "0.1.0" dependencies = [ + "log", "math", "serde", ] @@ -291,6 +292,15 @@ version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +dependencies = [ + "cfg-if", +] + [[package]] name = "lzw" version = "0.10.0" diff --git a/src/game.rs b/src/game.rs index 4cf0c2b..e9ab5a0 100644 --- a/src/game.rs +++ b/src/game.rs @@ -2,6 +2,7 @@ use crate::network::NetworkHandler; use crate::player::{Player, PlayerId}; use core::events::{ClientEvent, ServerEvent}; +use core::utils::logging::info; use core::utils::sleep; use core::world::World; use std::collections::HashMap; @@ -55,7 +56,7 @@ impl Game { let tps = 1.0 / start.elapsed().as_secs_f64(); // TODO: make a struct for ServerStats - println!( + info!( "mspt: {:.3}, tps: {:.1}, players: {}", mspt, tps, diff --git a/src/main.rs b/src/main.rs index 8336da6..4033bce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ mod player; use crate::game::Game; +use core::utils::logging::info; use std::io; gflags::define! { @@ -25,7 +26,7 @@ fn main() -> io::Result<()> { gflags::parse(); if HELP.flag { - println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); + info!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); gflags::print_help_and_exit(0); }