tiny_tracing/time.rs
1use chrono::Local;
2use tracing_subscriber::fmt::{format::Writer, time::FormatTime};
3
4/// Formats timestamps using the local system time via [`chrono::Local`].
5pub struct LocalTimer;
6
7impl FormatTime for LocalTimer {
8 fn format_time(&self, w: &mut Writer<'_>) -> std::fmt::Result {
9 let now = Local::now();
10 write!(w, "{}", now.format("%Y-%m-%d %H:%M:%S"))
11 }
12}