Trait bevy_mod_sysfail::FailureMode
source · pub trait FailureMode {
type ID: Hash + Eq;
fn log_level(&self) -> LogLevel;
fn identify(&self) -> Self::ID;
fn display(&self) -> Option<String>;
fn cooldown(&self) -> Duration { ... }
fn log(&self) { ... }
}
Expand description
Something that can be logged in a sysfail
handler
Required Associated Types§
Required Methods§
sourcefn display(&self) -> Option<String>
fn display(&self) -> Option<String>
What to log, the default FailureMode::log
impl does nothing if
None
.
Provided Methods§
sourcefn cooldown(&self) -> Duration
fn cooldown(&self) -> Duration
How long an error must not be produced in order to be displayed again.
This controls when FailureMode::log
is called.
Return Duration::ZERO
to trigger FailureMode::log
each time there
is an error.
sourcefn log(&self)
fn log(&self)
What happens, by default this logs based on the return value of
FailureMode::log_level
.
Examples
https://crates.io/crates/bevy_debug_text_overlay provides a wrapper struct to replace log-printing with displaying errors on screen.