Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,18 @@ pre-release-replacements = [
]

[features]
default = ["auto-color", "humantime", "regex"]
default = ["auto-color", "cyborgtime", "regex"]
color = ["dep:anstream", "dep:anstyle"]
auto-color = ["color", "anstream/auto"]
humantime = ["dep:humantime"]
cyborgtime = ["dep:cyborgtime"]
humantime = ["dep:cyborgtime"]
regex = ["env_filter/regex"]
unstable-kv = ["log/kv"]

[dependencies]
log = { version = "0.4.21", features = ["std"] }
env_filter = { version = "0.1.0", path = "crates/env_filter", default-features = false }
humantime = { version = "2.0.0", optional = true }
cyborgtime = { version = "2.0.0", optional = true }
anstream = { version = "0.6.11", default-features = false, features = ["wincon"], optional = true }
anstyle = { version = "1.0.6", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions examples/custom_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $ export MY_LOG_STYLE=never
If you want to control the logging output completely, see the `custom_logger` example.
*/

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

Expand Down Expand Up @@ -49,5 +49,5 @@ fn main() {
log::info!("a log from `MyLogger`");
}

#[cfg(not(all(feature = "color", feature = "humantime")))]
#[cfg(not(all(feature = "color", any(feature = "cyborgtime", feature = "humantime"))))]
fn main() {}
2 changes: 1 addition & 1 deletion src/fmt/humantime.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt;
use std::time::SystemTime;

use humantime::{
use cyborgtime::{
format_rfc3339_micros, format_rfc3339_millis, format_rfc3339_nanos, format_rfc3339_seconds,
};

Expand Down
8 changes: 4 additions & 4 deletions src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use std::{fmt, io, mem};
use log::Level;
use log::Record;

#[cfg(feature = "humantime")]
#[cfg(any(feature = "cyborgtime", feature = "humantime"))]
mod humantime;
#[cfg(feature = "unstable-kv")]
mod kv;
Expand All @@ -76,7 +76,7 @@ pub(crate) mod writer;
#[cfg(feature = "color")]
pub use anstyle as style;

#[cfg(feature = "humantime")]
#[cfg(any(feature = "cyborgtime", feature = "humantime"))]
pub use self::humantime::Timestamp;
#[cfg(feature = "unstable-kv")]
pub use self::kv::*;
Expand Down Expand Up @@ -396,7 +396,7 @@ impl DefaultFormat<'_> {
}

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

self.write_header_value(ts)
}
#[cfg(not(feature = "humantime"))]
#[cfg(not(any(feature = "cyborgtime", feature = "humantime")))]
{
// Trick the compiler to think we have used self.timestamp
// Workaround for "field is never used: `timestamp`" compiler nag.
Expand Down