.
//
//!
//! # Iso8601 Formatter
//!
use ::fmt;
use crate::FormatTrait;
///
/// ISO 8601 / RFC 3339 date & time format.
///
/// Example:
/// ```text
/// 2001-07-08T00:34:60.026490+09:30
/// ```
/// Template:
/// - `dt` in the template would be the datetime string, similar to the above.
/// - `mod_path`, `fn_name`, `level`, and `message` all come out of the `LogEntry`
/// provided to the [`format()`][Iso8601Formatter::format] method.
///
/// ```ignore
/// format!("{dt:35} {mod_path}->{fn_name} [{level:7}] {message}");
/// ```
/// Sample output:
/// ```text
/// 2025-07-18T14:01:01.051532664+08:00 flogging->main [WARNING] Rain is wet!
/// ```
///
#[derive(,,,,)]
pub struct Iso8601Formatter {
dt_fmt:
fmt_string:
}
impl Iso8601Formatter {
///
/// Creates a new instance of `Iso8601Formatter`.
///
pub fn new() -> Self {
Self {
: "%+"to_string(),
: "{dt:35} {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 Iso8601Formatter {
fn default() -> Self {
Self::()
}
}
impl ::for Iso8601Formatter {
fn fmt(&selff: &mut ::<_>) -> :: {
write!(
"dt_fmt: \"{}\" - fmt_string: \"{}\"",
self, self
)
}
}
impl for Iso8601Formatter {
fn format(&selflog_entry: &::) -> {
selfft_fmt(selfdt_fmt(), selffmt_string(),)
}
}