.
//
//!
//! # Simple Formatter
//!
use ::fmt;
use crate::FormatTrait;
///
/// Simple format.
///
/// Template:
/// - `mod_path`, `fn_name`, `level`, and `message` all come out of the `LogEntry`
/// provided to the [`format()`][SimpleFormatter::format] method.
/// ```ignore
/// format!("{mod_path}->{fn_name} [{level:7}] {message}");
/// ```
/// Sample output:
/// ```text
/// flogging->main [INFO ] It is cloudy today.
/// ```
///
#[derive(,,,,)]
pub struct SimpleFormatter {
dt_fmt:
fmt_string:
}
impl SimpleFormatter {
///
/// Creates a new instance of `SimpleFormatter`.
///
pub fn new() -> Self {
Self {
: ""to_string(),
: "{mod_path}->{fn_name} [{level:7}] {message}"to_string(),
}
}
///
/// Returns the date/time format string.
///
pub fn dt_fmt(&self) -> {
selfclone()
}
///
/// Returns the primary format string.
///
pub fn fmt_string(&self) -> {
selfclone()
}
}
impl for SimpleFormatter {
fn default() -> Self {
Self::()
}
}
impl ::for SimpleFormatter {
fn fmt(&selff: &mut ::<_>) -> :: {
write!(
"dt_fmt: \"{}\" - fmt_string: \"{}\"",
self, self
)
}
}
impl for SimpleFormatter {
fn format(&selflog_entry: &::) -> {
selfft_fmt(selfdt_fmt(), selffmt_string(),)
}
}