diff --git a/src/lib.rs b/src/lib.rs index b2d1d60..816b160 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -62,7 +62,6 @@ impl Plugin for ConsolePlugin { ( console_ui.in_set(ConsoleSet::ConsoleUI), receive_console_line.in_set(ConsoleSet::PostCommands), - send_log_buffer_to_console.in_set(ConsoleSet::PostCommands), ), ) .configure_sets( diff --git a/src/log.rs b/src/log.rs index 26659ca..3a1374e 100644 --- a/src/log.rs +++ b/src/log.rs @@ -4,12 +4,12 @@ use std::{ }; use bevy::{ - app::App, + app::{App, Update}, log::tracing_subscriber::{self, Registry}, - prelude::{EventWriter, ResMut, Resource}, + prelude::{EventWriter, IntoSystemConfigs, ResMut, Resource}, }; -use crate::PrintConsoleLine; +use crate::{ConsoleSet, PrintConsoleLine}; /// Buffers logs written by bevy at runtime #[derive(Resource)] @@ -63,6 +63,10 @@ pub fn make_layer( ) -> Option + Send + Sync>> { let buffer = Arc::new(Mutex::new(std::io::Cursor::new(Vec::new()))); app.insert_resource(BevyLogBuffer(buffer.clone())); + app.add_systems( + Update, + send_log_buffer_to_console.in_set(ConsoleSet::PostCommands), + ); Some(Box::new( tracing_subscriber::fmt::Layer::new()