pub trait HandlerTrait:
Display
+ Send
+ Sync {
// Required methods
fn create(name: &str) -> Result<Self, Error>
where Self: Sized;
fn close(&mut self);
fn flush(&mut self);
fn get_log(&self) -> String;
fn get_formatter(&self) -> Formatter;
fn is_open(&self) -> bool;
fn publish(&mut self, log_entry: &LogEntry);
fn set_formatter(&mut self, formatter: Formatter);
}Expand description
Provides common methods required for all handlers.
Required Methods§
Sourcefn close(&mut self)
fn close(&mut self)
Close the Handler and free all associated resources.
The close method will perform a flush and then close the Handler.
After close has been called, this Handler should no longer be used.
Method calls will be silently ignored.
Sourcefn get_formatter(&self) -> Formatter
fn get_formatter(&self) -> Formatter
Return the Formatter for this Handler.
Sourcefn publish(&mut self, log_entry: &LogEntry)
fn publish(&mut self, log_entry: &LogEntry)
Publish a LogEntry.
The logging request was made initially to a Logger object, which initialized the LogEntry and forwarded it here.
The Handler is responsible for formatting the message, when and if necessary.
§Parameters
log_entry- TheLogEntryto be published.