pub struct LogPlugin {
pub filter: String,
pub level: Level,
pub update_subscriber: Option<fn(_: Box<dyn Subscriber + Send + Sync>) -> Box<dyn Subscriber + Send + Sync>>,
}
Expand description
Adds logging to Apps. This plugin is part of the DefaultPlugins
. Adding
this plugin will setup a collector appropriate to your target platform:
- Using
tracing-subscriber
by default, logging tostdout
. - Using
android_log-sys
on Android, logging to Android logs. - Using
tracing-wasm
in WASM, logging to the browser console.
You can configure this plugin.
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(LogPlugin {
level: Level::DEBUG,
filter: "wgpu=error,bevy_render=info,bevy_ecs=trace".to_string(),
update_subscriber: None,
}))
.run();
}
Log level can also be changed using the RUST_LOG
environment variable.
For example, using RUST_LOG=wgpu=error,bevy_render=info,bevy_ecs=trace cargo run ..
It has the same syntax as the field LogPlugin::filter
, see EnvFilter
.
If you define the RUST_LOG
environment variable, the LogPlugin
settings
will be ignored.
If you want to setup your own tracing collector, you should disable this
plugin from DefaultPlugins
:
fn main() {
App::new()
.add_plugins(DefaultPlugins.build().disable::<LogPlugin>())
.run();
}
Panics
This plugin should not be added multiple times in the same process. This plugin sets up global logging configuration for all Apps in a given process, and rerunning the same initialization multiple times will lead to a panic.
Fields§
§filter: String
Filters logs using the EnvFilter
format
level: Level
Filters out logs that are “less than” the given level.
This can be further filtered using the filter
setting.
update_subscriber: Option<fn(_: Box<dyn Subscriber + Send + Sync>) -> Box<dyn Subscriber + Send + Sync>>
Optionally apply extra transformations to the tracing subscriber.
For example add Layers
Trait Implementations§
source§impl Plugin for LogPlugin
impl Plugin for LogPlugin
source§fn ready(&self, _app: &App) -> bool
fn ready(&self, _app: &App) -> bool
finish
should be called.source§fn finish(&self, _app: &mut App)
fn finish(&self, _app: &mut App)
App
, once all plugins registered are ready. This can
be useful for plugins that depends on another plugin asynchronous setup, like the renderer.source§fn cleanup(&self, _app: &mut App)
fn cleanup(&self, _app: &mut App)
Auto Trait Implementations§
impl RefUnwindSafe for LogPlugin
impl Send for LogPlugin
impl Sync for LogPlugin
impl Unpin for LogPlugin
impl UnwindSafe for LogPlugin
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.