devlog_tracing/time_format.rs
1use core::fmt;
2
3use chrono::Local;
4use tracing_subscriber::fmt::{format::Writer, time::FormatTime};
5
6#[derive(Default)]
7pub struct DevLogTimeFormat {
8 // Prevents direct struct initialization, so we can add fields here later as a non-breaking
9 // change.
10 _private: (),
11}
12
13impl FormatTime for DevLogTimeFormat {
14 fn format_time(&self, writer: &mut Writer<'_>) -> fmt::Result {
15 let time = Local::now();
16 write!(writer, "[{}]", time.format("%H:%M:%S"))?;
17 Ok(())
18 }
19}