Skip to content

Commit 4f0d200

Browse files
ShellWowzaTechcable
authored andcommitted
Replace chrono with time
1 parent c45d094 commit 4f0d200

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ default = []
2020
slog = { version = "2.1.1" }
2121
serde_json = "1"
2222
serde = "1"
23-
chrono = { version = "0.4", default-features = false, features = ["clock"] }
2423
erased-serde = {version = "0.3", optional = true }
24+
time = { version = "0.3.6", features = ["formatting", "local-offset"] }
2525

2626
[dev-dependencies]
2727
slog-async = "2"

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,11 @@ where
331331
/// * `msg` - msg - formatted logging message
332332
pub fn add_default_keys(self) -> Self {
333333
self.add_key_value(o!(
334-
"ts" => PushFnValue(move |_ : &Record, ser| {
335-
ser.emit(chrono::Local::now().to_rfc3339())
334+
"ts" => FnValue(move |_ : &Record| {
335+
time::OffsetDateTime::now_local()
336+
.unwrap_or_else(|_| time::OffsetDateTime::now_utc())
337+
.format(&time::format_description::well_known::Rfc3339)
338+
.ok()
336339
}),
337340
"level" => FnValue(move |rinfo : &Record| {
338341
rinfo.level().as_short_str()

0 commit comments

Comments
 (0)