Skip to content

Commit a84b6e5

Browse files
committed
Replace humantime with cyborgtime
humantime seems to be unmaintained and cyborgtime is fork of it. This change shouldn't affect end users. E.g. "humantime" feature is kept as is. I also introduced "cyborgtime" feature that currently works same as "humantime".
1 parent a93b787 commit a84b6e5

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,18 @@ pre-release-replacements = [
117117
]
118118

119119
[features]
120-
default = ["auto-color", "humantime", "regex"]
120+
default = ["auto-color", "cyborgtime", "regex"]
121121
color = ["dep:anstream", "dep:anstyle"]
122122
auto-color = ["color", "anstream/auto"]
123-
humantime = ["dep:humantime"]
123+
cyborgtime = ["dep:cyborgtime"]
124+
humantime = ["dep:cyborgtime"]
124125
regex = ["env_filter/regex"]
125126
unstable-kv = ["log/kv"]
126127

127128
[dependencies]
128129
log = { version = "0.4.21", features = ["std"] }
129130
env_filter = { version = "0.1.0", path = "crates/env_filter", default-features = false }
130-
humantime = { version = "2.0.0", optional = true }
131+
cyborgtime = { version = "2.0.0", optional = true }
131132
anstream = { version = "0.6.11", default-features = false, features = ["wincon"], optional = true }
132133
anstyle = { version = "1.0.6", optional = true }
133134

examples/custom_format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $ export MY_LOG_STYLE=never
1717
If you want to control the logging output completely, see the `custom_logger` example.
1818
*/
1919

20-
#[cfg(all(feature = "color", feature = "humantime"))]
20+
#[cfg(all(feature = "color", any(feature = "cyborgtime", feature = "humantime")))]
2121
fn main() {
2222
use env_logger::{Builder, Env};
2323

@@ -49,5 +49,5 @@ fn main() {
4949
log::info!("a log from `MyLogger`");
5050
}
5151

52-
#[cfg(not(all(feature = "color", feature = "humantime")))]
52+
#[cfg(not(all(feature = "color", any(feature = "cyborgtime", feature = "humantime"))))]
5353
fn main() {}

src/fmt/humantime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt;
22
use std::time::SystemTime;
33

4-
use humantime::{
4+
use cyborgtime::{
55
format_rfc3339_micros, format_rfc3339_millis, format_rfc3339_nanos, format_rfc3339_seconds,
66
};
77

src/fmt/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use std::{fmt, io, mem};
6767
use log::Level;
6868
use log::Record;
6969

70-
#[cfg(feature = "humantime")]
70+
#[cfg(any(feature = "cyborgtime", feature = "humantime"))]
7171
mod humantime;
7272
#[cfg(feature = "unstable-kv")]
7373
mod kv;
@@ -76,7 +76,7 @@ pub(crate) mod writer;
7676
#[cfg(feature = "color")]
7777
pub use anstyle as style;
7878

79-
#[cfg(feature = "humantime")]
79+
#[cfg(any(feature = "cyborgtime", feature = "humantime"))]
8080
pub use self::humantime::Timestamp;
8181
#[cfg(feature = "unstable-kv")]
8282
pub use self::kv::*;
@@ -396,7 +396,7 @@ impl DefaultFormat<'_> {
396396
}
397397

398398
fn write_timestamp(&mut self) -> io::Result<()> {
399-
#[cfg(feature = "humantime")]
399+
#[cfg(any(feature = "cyborgtime", feature = "humantime"))]
400400
{
401401
use self::TimestampPrecision::{Micros, Millis, Nanos, Seconds};
402402
let ts = match self.timestamp {
@@ -409,7 +409,7 @@ impl DefaultFormat<'_> {
409409

410410
self.write_header_value(ts)
411411
}
412-
#[cfg(not(feature = "humantime"))]
412+
#[cfg(not(any(feature = "cyborgtime", feature = "humantime")))]
413413
{
414414
// Trick the compiler to think we have used self.timestamp
415415
// Workaround for "field is never used: `timestamp`" compiler nag.

0 commit comments

Comments
 (0)