pub trait FormatterTrait:
Send
+ Sync
+ Debug {
// Required methods
fn fmt(&self, record: &Record) -> String;
fn with_colors(&mut self, use_colors: bool);
fn with_timestamp(&mut self, include_timestamp: bool);
fn with_level(&mut self, include_level: bool);
fn with_module(&mut self, include_module: bool);
fn with_location(&mut self, include_location: bool);
fn with_pattern(&mut self, pattern: String);
fn with_format(&mut self, format_fn: FormatFn);
fn box_clone(&self) -> Box<dyn FormatterTrait + Send + Sync>;
// Provided method
fn fmt_batch(&self, records: &[Record]) -> String { ... }
}
Expand description
A trait for formatters that format log records
Required Methods§
Sourcefn with_colors(&mut self, use_colors: bool)
fn with_colors(&mut self, use_colors: bool)
Enable or disable colored output
Sourcefn with_timestamp(&mut self, include_timestamp: bool)
fn with_timestamp(&mut self, include_timestamp: bool)
Enable or disable timestamp output
Sourcefn with_level(&mut self, include_level: bool)
fn with_level(&mut self, include_level: bool)
Enable or disable level output
Sourcefn with_module(&mut self, include_module: bool)
fn with_module(&mut self, include_module: bool)
Enable or disable module output
Sourcefn with_location(&mut self, include_location: bool)
fn with_location(&mut self, include_location: bool)
Enable or disable location output
Sourcefn with_pattern(&mut self, pattern: String)
fn with_pattern(&mut self, pattern: String)
Set the pattern for formatting
Sourcefn with_format(&mut self, format_fn: FormatFn)
fn with_format(&mut self, format_fn: FormatFn)
Set a custom format function