aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <[email protected]>2024-07-24 12:02:10 -0400
committerLibravatar Silas Bartha <[email protected]>2024-07-24 12:02:10 -0400
commit345e0665bfc9cb796d054c106f56966e9d5a7e22 (patch)
tree5a4b371cbb8231048d13d07e0c4249834dbc379b /src/lib.rs
parentf6b9eda55d3a2f3dbae7e1671138cf10d4151f17 (diff)
Update to bevy 0.14 + Add 0BSD Optionv0.3.0
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 11ee50c..f64bbd3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,15 +10,13 @@ use std::{
use bevy::{
log::{
- tracing_subscriber::{self, prelude::*, Registry},
+ tracing_subscriber::{self, layer::SubscriberExt, EnvFilter, Layer, Registry},
Level, LogPlugin,
- },
- prelude::*,
- utils::tracing::level_filters::LevelFilter,
+ }, prelude::*, utils::tracing::{level_filters::LevelFilter, subscriber}
};
use bevy_dither_post_process::DitherPostProcessPlugin;
-use bevy_framebuffer_extract::FramebufferExtractPlugin;
+use bevy_headless_render::HeadlessRenderPlugin;
pub use crossterm;
use once_cell::sync::Lazy;
pub use ratatui;
@@ -53,29 +51,25 @@ impl Plugin for TerminalDisplayPlugin {
*LOG_PATH
.lock()
.expect("Failed to get lock on log path mutex") = self.log_path.clone();
+ let log_file = OpenOptions::new()
+ .write(true)
+ .create(true)
+ .truncate(true)
+ .open(
+ LOG_PATH
+ .lock()
+ .expect("Failed to get lock on log path mutex")
+ .clone(),
+ )
+ .unwrap();
+ let file_layer = tracing_subscriber::fmt::Layer::new()
+ .with_writer(log_file)
+ .with_filter(EnvFilter::builder().parse_lossy(format!("{},{}", Level::INFO, "wgpu=error,naga=warn")));
+ let subscriber = Registry::default().with(file_layer);
+ subscriber::set_global_default(subscriber).unwrap();
app.add_plugins((
DitherPostProcessPlugin,
- FramebufferExtractPlugin,
- LogPlugin {
- update_subscriber: Some(|_| {
- let log_file = OpenOptions::new()
- .write(true)
- .create(true)
- .truncate(true)
- .open(
- LOG_PATH
- .lock()
- .expect("Failed to get lock on log path mutex")
- .clone(),
- )
- .unwrap();
- let file_layer = tracing_subscriber::fmt::Layer::new()
- .with_writer(log_file)
- .with_filter(LevelFilter::from_level(Level::INFO));
- Box::new(Registry::default().with(file_layer))
- }),
- ..Default::default()
- },
+ HeadlessRenderPlugin,
))
.add_systems(Startup, input::systems::setup_input)
.add_systems(