pub struct LogPlugin {
pub filter: String,
pub level: LogLevel,
pub custom_layer: fn(app: &mut App) -> Option<Box<dyn Layer<Registry> + Send + Sync + 'static>>,
pub fmt_layer: fn(app: &mut App) -> Option<Box<dyn Layer<Layered<EnvFilter, Layered<Option<Box<dyn Layer<Registry> + Send + Sync>>, Registry>>> + Send + Sync + 'static>>,
pub log_file: PathBuf,
}Expand description
Plugin that configures logging for WaterDropEngine applications.
§Configuration
The RUST_LOG environment variable overrides plugin settings and uses [EnvFilter] syntax.
Set NO_COLOR=1 to disable colored output (see no-color.org).
§Log Levels
Available log levels (most to least important):
error!()- Critical failureswarn!()- Important warningsinfo!()- General informationdebug!()- Debug informationtrace!()- Verbose tracing
Fields§
§filter: StringFilters logs using the [EnvFilter] format
level: LogLevelFilters out logs that are “less than” the given level. This can be further filtered using the filter setting.
custom_layer: fn(app: &mut App) -> Option<Box<dyn Layer<Registry> + Send + Sync + 'static>>Optionally add an extra [Layer] to the tracing subscriber.
fmt_layer: fn(app: &mut App) -> Option<Box<dyn Layer<Layered<EnvFilter, Layered<Option<Box<dyn Layer<Registry> + Send + Sync>>, Registry>>> + Send + Sync + 'static>>Override the default [tracing_subscriber::fmt::Layer] with a custom one.
For example, you can use [tracing_subscriber::fmt::Layer::without_time] to remove the
timestamp from the log output.
log_file: PathBufPath of the file logs are written to. The previous log file, if any, is renamed
alongside it with a -old suffix before its extension (e.g. log.txt -> log-old.txt).
Defaults to <temp_dir>/waterdropengine/log.txt.
Implementations§
Source§impl LogPlugin
impl LogPlugin
Sourcepub fn auto_level(self) -> Self
pub fn auto_level(self) -> Self
Sets the log level based on debug/release mode.
Sourcepub fn with_crate_level(self, target: &str, level: LogLevel) -> Self
pub fn with_crate_level(self, target: &str, level: LogLevel) -> Self
Overrides the log level for a specific crate/module target, regardless of the global level.
This is useful to keep the engine’s own logs quiet (e.g. LogLevel::INFO) while enabling
more verbose logging (e.g. LogLevel::DEBUG) for your own game/application crate.
target should be the crate’s module path as used by tracing (i.e. the crate name with
- replaced by _), such as "my_game".
Trait Implementations§
Source§impl Plugin for LogPlugin
impl Plugin for LogPlugin
§fn ready(&self, _app: &App) -> bool
fn ready(&self, _app: &App) -> bool
finish should be called.§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.§fn cleanup(&self, _app: &mut App)
fn cleanup(&self, _app: &mut App)
Auto Trait Implementations§
impl Freeze for LogPlugin
impl RefUnwindSafe for LogPlugin
impl Send for LogPlugin
impl Sync for LogPlugin
impl Unpin for LogPlugin
impl UnsafeUnpin for LogPlugin
impl UnwindSafe for LogPlugin
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more