use std::fmt;
use crate::FormatTrait;
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct MockFormatter {
dt_fmt: String,
fmt_string: String,
}
impl MockFormatter {
pub fn new() -> Self {
Self {
dt_fmt: "".to_string(),
fmt_string: "MockFormatter".to_string(),
}
}
pub fn dt_fmt(&self) -> String {
self.dt_fmt.clone()
}
pub fn fmt_string(&self) -> String {
self.fmt_string.clone()
}
}
impl Default for MockFormatter {
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for MockFormatter {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.fmt_string())
}
}
impl FormatTrait for MockFormatter {
fn format(&self, _log_entry: &crate::LogEntry) -> String {
let _ = self.dt_fmt();
"MockFormatter".to_string()
}
}