separate logging into a library

This commit is contained in:
griffi-gh 2023-02-10 20:44:34 +01:00
parent 1c35573bba
commit d5abf53ee0
7 changed files with 20 additions and 6 deletions

View file

@ -1,5 +1,5 @@
[workspace]
members = ["kubi", "kubi-server", "kubi-shared", "kubi-udp"]
members = ["kubi", "kubi-server", "kubi-shared", "kubi-udp", "kubi-logging"]
resolver = "2"
[profile.release-with-debug]

8
kubi-logging/Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "kubi-logging"
version = "0.1.0"
edition = "2021"
[dependencies]
log = "0.4"
env_logger = "0.10"

View file

@ -1,9 +1,13 @@
//! Custom env_logger options and styling
/// Custom env_logger options and styling
use env_logger::{fmt::Color, Builder, Env};
use log::Level;
use std::io::Write;
pub use log;
pub use env_logger;
#[inline]
pub fn init() {
let env = Env::default()
.filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn");

View file

@ -6,4 +6,6 @@ edition = "2021"
[dependencies]
kubi-shared = { path = "../kubi-shared" }
kubi-udp = { path = "../kubi-udp" }
kubi-logging = { path = "../kubi-logging" }
log = "*"
shipyard = "0.6"

View file

@ -37,6 +37,7 @@ fn update() -> Workload {
}
fn main() {
kubi_logging::init();
let world = World::new();
world.add_workload(initialize);
world.add_workload(update);

View file

@ -6,11 +6,11 @@ edition = "2021"
[dependencies]
kubi-shared = { path = "../kubi-shared" }
kubi-udp = { path = "../kubi-udp", optional = true }
kubi-logging = { path = "../kubi-logging" }
log = "*"
glium = "0.32"
glam = { version = "0.22", features = ["debug-glam-assert", "fast-math"] }
image = { version = "0.24", default_features = false, features = ["png"] }
log = "0.4"
env_logger = "0.10"
strum = { version = "0.24", features = ["derive"] }
hashbrown = "0.13"
rayon = "1.6"

View file

@ -18,7 +18,6 @@ use glium::{
use glam::vec3;
use std::time::Instant;
mod logging;
pub(crate) mod rendering;
pub(crate) mod world;
pub(crate) mod player;
@ -148,7 +147,7 @@ fn main() {
#[cfg(all(windows, not(debug_assertions)))] attach_console();
//Init env_logger
logging::init();
kubi_logging::init();
//Create a shipyard world
let mut world = World::new();