Fix the logger to include info logs from other crates
This commit is contained in:
parent
3d350448dc
commit
81c3b5be55
|
@ -505,6 +505,16 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-channel"
|
||||||
|
version = "0.5.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"crossbeam-utils",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.16"
|
version = "0.8.16"
|
||||||
|
@ -525,6 +535,12 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "deranged"
|
||||||
|
version = "0.3.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dispatch"
|
name = "dispatch"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -960,6 +976,12 @@ dependencies = [
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jni-sys"
|
name = "jni-sys"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -1099,6 +1121,7 @@ dependencies = [
|
||||||
"syn 2.0.26",
|
"syn 2.0.26",
|
||||||
"tobj",
|
"tobj",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"tracing-appender",
|
||||||
"tracing-log",
|
"tracing-log",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"wgpu",
|
"wgpu",
|
||||||
|
@ -1666,6 +1689,12 @@ dependencies = [
|
||||||
"tiny-skia",
|
"tiny-skia",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.185"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "be9b6f69f1dfd54c3b568ffa45c310d6973a5e5148fd40cf515acaf38cf5bc31"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sharded-slab"
|
name = "sharded-slab"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
|
@ -1842,6 +1871,34 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48"
|
||||||
|
dependencies = [
|
||||||
|
"deranged",
|
||||||
|
"itoa",
|
||||||
|
"serde",
|
||||||
|
"time-core",
|
||||||
|
"time-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-core"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-macros"
|
||||||
|
version = "0.2.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572"
|
||||||
|
dependencies = [
|
||||||
|
"time-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tiny-fn"
|
name = "tiny-fn"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -1911,6 +1968,17 @@ dependencies = [
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-appender"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-channel",
|
||||||
|
"time",
|
||||||
|
"tracing-subscriber",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-attributes"
|
name = "tracing-attributes"
|
||||||
version = "0.1.26"
|
version = "0.1.26"
|
||||||
|
|
|
@ -30,3 +30,4 @@ quote = "1.0.29"
|
||||||
edict = "0.5.0"
|
edict = "0.5.0"
|
||||||
atomicell = "0.1.9"
|
atomicell = "0.1.9"
|
||||||
aligned-vec = "0.5.0"
|
aligned-vec = "0.5.0"
|
||||||
|
tracing-appender = "0.2.2"
|
||||||
|
|
34
src/game.rs
34
src/game.rs
|
@ -4,11 +4,12 @@ use async_std::{task::block_on, sync::Mutex};
|
||||||
|
|
||||||
//use hecs::World;
|
//use hecs::World;
|
||||||
use instant::Instant;
|
use instant::Instant;
|
||||||
use tracing::{metadata::LevelFilter, info, debug, warn, error};
|
use tracing::{metadata::LevelFilter, info, debug, warn, error, Level};
|
||||||
|
use tracing_appender::non_blocking;
|
||||||
use tracing_subscriber::{
|
use tracing_subscriber::{
|
||||||
layer::{Layer, SubscriberExt},
|
layer::{Layer, SubscriberExt},
|
||||||
filter::FilterFn,
|
filter::{FilterFn, self},
|
||||||
util::SubscriberInitExt,
|
util::SubscriberInitExt, fmt,
|
||||||
};
|
};
|
||||||
|
|
||||||
use winit::{window::{WindowBuilder, Window}, event::{Event, WindowEvent, KeyboardInput, ElementState, VirtualKeyCode, DeviceEvent}, event_loop::{EventLoop, ControlFlow}};
|
use winit::{window::{WindowBuilder, Window}, event::{Event, WindowEvent, KeyboardInput, ElementState, VirtualKeyCode, DeviceEvent}, event_loop::{EventLoop, ControlFlow}};
|
||||||
|
@ -305,7 +306,7 @@ impl Default for Game {
|
||||||
|
|
||||||
impl Game {
|
impl Game {
|
||||||
pub async fn initialize() -> Game {
|
pub async fn initialize() -> Game {
|
||||||
let filter = FilterFn::new(|metadata| {
|
/* let filter = FilterFn::new(|metadata| {
|
||||||
metadata.module_path()
|
metadata.module_path()
|
||||||
.unwrap_or_else(|| metadata.target())
|
.unwrap_or_else(|| metadata.target())
|
||||||
.starts_with("lyra_engine") && (LevelFilter::DEBUG >= metadata.level().to_owned())
|
.starts_with("lyra_engine") && (LevelFilter::DEBUG >= metadata.level().to_owned())
|
||||||
|
@ -315,7 +316,21 @@ impl Game {
|
||||||
|
|
||||||
tracing_subscriber::registry()
|
tracing_subscriber::registry()
|
||||||
.with(layer.with_filter(filter))
|
.with(layer.with_filter(filter))
|
||||||
.init();
|
.init(); */
|
||||||
|
|
||||||
|
|
||||||
|
/* tracing_subscriber::registry()
|
||||||
|
.with(fmt::layer().with_writer(stdout_layer))
|
||||||
|
.with(filter::Targets::new()
|
||||||
|
.with_target("lyra_engine", Level::TRACE)
|
||||||
|
.with_default(Level::DEBUG))
|
||||||
|
.init(); */
|
||||||
|
|
||||||
|
/* tracing_subscriber::fmt()
|
||||||
|
.with_max_level(Level::DEBUG)
|
||||||
|
.init(); */
|
||||||
|
|
||||||
|
info!("dheiudfgbwehifwe");
|
||||||
|
|
||||||
let mut def = Self::default();
|
let mut def = Self::default();
|
||||||
def.system_dispatcher.as_mut().unwrap().add_system("input", InputSystem::new(), &[]);
|
def.system_dispatcher.as_mut().unwrap().add_system("input", InputSystem::new(), &[]);
|
||||||
|
@ -345,6 +360,15 @@ impl Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run(&mut self) {
|
pub async fn run(&mut self) {
|
||||||
|
// init logging
|
||||||
|
let (stdout_layer, _stdout_nb) = non_blocking(std::io::stdout());
|
||||||
|
tracing_subscriber::registry()
|
||||||
|
.with(fmt::layer().with_writer(stdout_layer))
|
||||||
|
.with(filter::Targets::new()
|
||||||
|
.with_target("lyra_engine", Level::TRACE)
|
||||||
|
.with_default(Level::INFO))
|
||||||
|
.init();
|
||||||
|
|
||||||
let world = self.world.take().expect("ECS World was never given to Game!");
|
let world = self.world.take().expect("ECS World was never given to Game!");
|
||||||
|
|
||||||
let event_loop = EventLoop::new();
|
let event_loop = EventLoop::new();
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -115,19 +115,19 @@ async fn main() {
|
||||||
let mut dir_y = 0.0;
|
let mut dir_y = 0.0;
|
||||||
|
|
||||||
if keys.is_pressed(KeyCode::A) {
|
if keys.is_pressed(KeyCode::A) {
|
||||||
dir_x -= speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if keys.is_pressed(KeyCode::D) {
|
|
||||||
dir_x += speed;
|
dir_x += speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if keys.is_pressed(KeyCode::D) {
|
||||||
|
dir_x -= speed;
|
||||||
|
}
|
||||||
|
|
||||||
if keys.is_pressed(KeyCode::S) {
|
if keys.is_pressed(KeyCode::S) {
|
||||||
dir_y -= speed;
|
dir_y += speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if keys.is_pressed(KeyCode::W) {
|
if keys.is_pressed(KeyCode::W) {
|
||||||
dir_y += speed;
|
dir_y -= speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(keys);
|
drop(keys);
|
||||||
|
|
Loading…
Reference in New Issue