pub struct Builder { /* private fields */ }
Expand description
A Builder
that configures and initializes the Godot logger
godot-logger implements the builder pattern as the primary interface to configure and
initialize the logger. The configuration has sensible defaults that can be overwritten by
calling the corresponding setters on the Builder
struct. Once the configuration is done, the
logger can be initialized by calling the build
method.
§Examples
use log::Level;
use godot_logger::GodotLogger;
GodotLogger::builder()
.default_log_level(Level::Debug)
.init();
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn default_log_level(self, default_log_level: Level) -> Self
pub fn default_log_level(self, default_log_level: Level) -> Self
Sets the default log level
GodotLogger
matches all log records against a default log level. By default, only warnings
and errors are logged.
§Examples
use log::Level;
use godot_logger::GodotLogger;
let mut builder = GodotLogger::builder();
builder = builder.default_log_level(Level::Debug);
Sourcepub fn add_filter(self, module: &'static str, level: LevelFilter) -> Self
pub fn add_filter(self, module: &'static str, level: LevelFilter) -> Self
Adds a filter
Filters override the default log level for specific Rust modules.
§Examples
use godot_logger::GodotLogger;
use log::LevelFilter;
GodotLogger::builder().add_filter("godot_logger", LevelFilter::Off);
Sourcepub fn init(self) -> Result<(), SetLoggerError>
pub fn init(self) -> Result<(), SetLoggerError>
Initializes the logger
This method consumes the builder and initializes the logger with the current configuration of the builder. After calling this method, log records will be written to Godot’s output console.
§Examples
use log::Level;
use godot_logger::GodotLogger;
GodotLogger::builder().init();
Trait Implementations§
Source§impl Ord for Builder
impl Ord for Builder
Source§impl PartialOrd for Builder
impl PartialOrd for Builder
impl Eq for Builder
impl StructuralPartialEq for Builder
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.