pub trait FormatterTrait:
Send
+ Sync
+ Debug {
// Required methods
fn format(&self, record: &Record) -> String;
fn with_colors(self, use_colors: bool) -> Self
where Self: Sized;
fn with_timestamp(self, include_timestamp: bool) -> Self
where Self: Sized;
fn with_level(self, include_level: bool) -> Self
where Self: Sized;
fn with_module(self, include_module: bool) -> Self
where Self: Sized;
fn with_location(self, include_location: bool) -> Self
where Self: Sized;
fn with_pattern(self, pattern: impl Into<String>) -> Self
where Self: Sized;
fn with_format<F>(self, format_fn: F) -> Self
where F: Fn(&Record) -> String + Send + Sync + 'static,
Self: Sized;
fn box_clone(&self) -> Box<dyn FormatterTrait + Send + Sync>;
}Expand description
A trait for formatters that format log records
Required Methods§
Sourcefn with_colors(self, use_colors: bool) -> Selfwhere
Self: Sized,
fn with_colors(self, use_colors: bool) -> Selfwhere
Self: Sized,
Set whether to use colors
Sourcefn with_timestamp(self, include_timestamp: bool) -> Selfwhere
Self: Sized,
fn with_timestamp(self, include_timestamp: bool) -> Selfwhere
Self: Sized,
Set whether to include timestamps
Sourcefn with_level(self, include_level: bool) -> Selfwhere
Self: Sized,
fn with_level(self, include_level: bool) -> Selfwhere
Self: Sized,
Set whether to include the log level
Sourcefn with_module(self, include_module: bool) -> Selfwhere
Self: Sized,
fn with_module(self, include_module: bool) -> Selfwhere
Self: Sized,
Set whether to include the module path
Sourcefn with_location(self, include_location: bool) -> Selfwhere
Self: Sized,
fn with_location(self, include_location: bool) -> Selfwhere
Self: Sized,
Set whether to include the file and line number
Sourcefn with_pattern(self, pattern: impl Into<String>) -> Selfwhere
Self: Sized,
fn with_pattern(self, pattern: impl Into<String>) -> Selfwhere
Self: Sized,
Set the format pattern
Sourcefn with_format<F>(self, format_fn: F) -> Self
fn with_format<F>(self, format_fn: F) -> Self
Set a custom format function