Skip to content

Commit 120cd9e

Browse files
committed
bevy_log changes
1 parent d095a67 commit 120cd9e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

crates/bevy_log/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,25 @@ pub mod prelude {
3131
};
3232
}
3333

34+
#[cfg(feature = "tracing-chrome")]
35+
use bevy_utils::synccell::SyncCell;
3436
pub use bevy_utils::tracing::{
3537
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,
3638
Level,
3739
};
3840

3941
use bevy_app::{App, Plugin};
42+
#[cfg(feature = "tracing-chrome")]
43+
use bevy_ecs::system::Resource;
4044
use tracing_log::LogTracer;
4145
#[cfg(feature = "tracing-chrome")]
4246
use tracing_subscriber::fmt::{format::DefaultFields, FormattedFields};
4347
use tracing_subscriber::{prelude::*, registry::Registry, EnvFilter};
4448

49+
#[cfg(feature = "tracing-chrome")]
50+
#[derive(Resource)]
51+
pub(crate) struct FlushGuard(SyncCell<tracing_chrome::FlushGuard>);
52+
4553
/// Adds logging to Apps. This plugin is part of the `DefaultPlugins`. Adding
4654
/// this plugin will setup a collector appropriate to your target platform:
4755
/// * Using [`tracing-subscriber`](https://crates.io/crates/tracing-subscriber) by default,
@@ -152,7 +160,7 @@ impl Plugin for LogPlugin {
152160
}
153161
}))
154162
.build();
155-
app.insert_non_send_resource(guard);
163+
app.insert_resource(FlushGuard(SyncCell::new(guard)));
156164
chrome_layer
157165
};
158166

0 commit comments

Comments
 (0)