jiff support
#3128
LeoniePhiline
started this conversation in
Ideas
`jiff` support
#3128
Replies: 1 comment 1 reply
-
|
Maybe it helps someone, here's how to use jiff to format the current time. Note that I prefer jiff's fn setup_logging() {
struct JiffTimer {}
impl FormatTime for JiffTimer {
fn format_time(
&self,
w: &mut tracing_subscriber::fmt::format::Writer<'_>,
) -> std::fmt::Result {
static PRINTER: DateTimePrinter =
DateTimePrinter::new().separator(b' ').precision(Some(0));
PRINTER
.print_datetime(&jiff::Zoned::now().datetime(), jiff::fmt::StdFmtWrite(w))
.map_err(|_| std::fmt::Error)
}
}
tracing_subscriber::fmt::fmt()
.with_timer(JiffTimer {})
...
}Before: After: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Transitioning from
chronotojiff, I came across use of thetracing-subscriber"chrono"feature and thetracing_subscriber::fmt::time::ChronoLocaltime formatter.Are there any plans to support
jiffbased formatters?Would you accept pull requests adding
tracing_subscriber::fmt::time::JiffUtcandtracing_subscriber::fmt::time::JiffZonedbehind a"jiff"feature flag?Beta Was this translation helpful? Give feedback.
All reactions