Skip to content

Commit

Permalink
disable LogPlugin in docs and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cxreiff committed Oct 11, 2024
1 parent caa41f4 commit ecc2053
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ fn main() {
App::new()
.add_plugins((
// disable WinitPlugin as it panics in environments without a display server
DefaultPlugins.build().disable::<WinitPlugin>(),
// disable LogPlugin as it interferes with terminal output.
DefaultPlugins.build()
.disable::<WinitPlugin>()
.disable::<LogPlugin>(),

// create windowless loop and set its frame rate
ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 60.)),
Expand Down
6 changes: 5 additions & 1 deletion examples/cube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use bevy::app::AppExit;
use bevy::app::ScheduleRunnerPlugin;
use bevy::core_pipeline::tonemapping::Tonemapping;
use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin};
use bevy::log::LogPlugin;
use bevy::prelude::*;
use bevy::utils::error;
use bevy::winit::WinitPlugin;
Expand All @@ -30,7 +31,10 @@ pub struct Flags {
fn main() {
App::new()
.add_plugins((
DefaultPlugins.build().disable::<WinitPlugin>(),
DefaultPlugins
.build()
.disable::<WinitPlugin>()
.disable::<LogPlugin>(),
ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 60.)),
FrameTimeDiagnosticsPlugin,
RatatuiPlugins::default(),
Expand Down
4 changes: 3 additions & 1 deletion examples/multiple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use bevy::app::AppExit;
use bevy::app::ScheduleRunnerPlugin;
use bevy::core_pipeline::tonemapping::Tonemapping;
use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin};
use bevy::log::LogPlugin;
use bevy::prelude::*;
use bevy::utils::error;
use bevy::winit::WinitPlugin;
Expand Down Expand Up @@ -32,7 +33,8 @@ fn main() {
.add_plugins((
DefaultPlugins
.set(ImagePlugin::default_nearest())
.disable::<WinitPlugin>(),
.disable::<WinitPlugin>()
.disable::<LogPlugin>(),
ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 60.)),
FrameTimeDiagnosticsPlugin,
RatatuiPlugins::default(),
Expand Down
4 changes: 3 additions & 1 deletion examples/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::time::Duration;
use bevy::app::AppExit;
use bevy::app::ScheduleRunnerPlugin;
use bevy::core_pipeline::tonemapping::Tonemapping;
use bevy::log::LogPlugin;
use bevy::prelude::*;
use bevy::winit::WinitPlugin;
use bevy_ratatui::event::KeyEvent;
Expand All @@ -18,7 +19,8 @@ fn main() {
.add_plugins((
DefaultPlugins
.set(ImagePlugin::default_nearest())
.disable::<WinitPlugin>(),
.disable::<WinitPlugin>()
.disable::<LogPlugin>(),
ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 60.)),
RatatuiPlugins::default(),
RatatuiRenderPlugin::new("main", (256, 256))
Expand Down
4 changes: 3 additions & 1 deletion examples/shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::time::Duration;

use bevy::app::AppExit;
use bevy::core_pipeline::tonemapping::Tonemapping;
use bevy::log::LogPlugin;
use bevy::winit::WinitPlugin;
use bevy::{app::ScheduleRunnerPlugin, prelude::*};
use bevy_ratatui::event::KeyEvent;
Expand All @@ -17,7 +18,8 @@ fn main() {
.add_plugins((
DefaultPlugins
.set(ImagePlugin::default_nearest())
.disable::<WinitPlugin>(),
.disable::<WinitPlugin>()
.disable::<LogPlugin>(),
ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 60.)),
RatatuiPlugins::default(),
RatatuiRenderPlugin::new("main", (256, 256))
Expand Down
14 changes: 9 additions & 5 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,26 @@ pub type AutoresizeConversionFn = fn((u32, u32)) -> (u32, u32);
/// # use bevy::app::ScheduleRunnerPlugin;
/// # use bevy::winit::WinitPlugin;
/// # use bevy::prelude::*;
/// # use bevy::log::LogPlugin;
/// # use bevy_ratatui::RatatuiPlugins;
/// # use bevy_ratatui_render::{RatatuiRenderContext, RatatuiRenderPlugin};
/// #
/// fn main() {
/// App::new()
/// .add_plugins((
/// // disable WinitPlugin as it panics in environments without a display server
/// DefaultPlugins.build().disable::<WinitPlugin>(),
/// // disable WinitPlugin as it panics in environments without a display server.
/// // disable LogPlugin as it interferes with terminal output.
/// DefaultPlugins.build()
/// .disable::<WinitPlugin>()
/// .disable::<LogPlugin>(),
///
/// // create windowless loop and set its frame rate
/// // create windowless loop and set its frame rate.
/// ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 60.)),
///
/// // set up the Ratatui context and forward input events
/// // set up the Ratatui context and forward input events.
/// RatatuiPlugins::default(),
///
/// // connect a bevy camera target to a ratatui widget
/// // connect a bevy camera target to a ratatui widget.
/// RatatuiRenderPlugin::new("main", (256, 256)).print_full_terminal().autoresize(),
/// ))
/// .add_systems(Startup, setup_scene);
Expand Down

0 comments on commit ecc2053

Please sign in to comment.