pub trait Loggable {
// Required method
fn log(&self, msg: &str);
// Provided methods
fn info(&self, msg: &str) { ... }
fn success(&self, msg: &str) { ... }
fn warn(&self, msg: &str) { ... }
fn error(&self, msg: &str) { ... }
fn header(&self, _title: &str, _color_fn: fn(Colors) -> &'static str) { ... }
}Expand description
Trait for logger output destinations.
This trait allows loggers to write to different destinations (console, files, test collectors) without hardcoding the specific destination. This makes loggers testable by allowing output capture.
This trait mirrors the Printable trait pattern used for printers,
providing a unified interface for both production and test loggers.
Required Methods§
Provided Methods§
Sourcefn info(&self, msg: &str)
fn info(&self, msg: &str)
Log an informational message.
Default implementation formats the message with INFO prefix
and delegates to the log method.
Sourcefn success(&self, msg: &str)
fn success(&self, msg: &str)
Log a success message.
Default implementation formats the message with [OK] prefix
and delegates to the log method.
Sourcefn warn(&self, msg: &str)
fn warn(&self, msg: &str)
Log a warning message.
Default implementation formats the message with WARN prefix
and delegates to the log method.