Skip to content

Commit

Permalink
fix bug where system exists without necessary resource (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
makspll authored Sep 7, 2024
1 parent 5d89a1e commit 7b80b21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 7 additions & 3 deletions src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -63,6 +63,10 @@ pub fn make_layer(
) -> Option<Box<dyn tracing_subscriber::Layer<Registry> + 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()
Expand Down

0 comments on commit 7b80b21

Please sign in to comment.