diff --git a/Cargo.toml b/Cargo.toml index 72c3650..6276c0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ nu-ansi-term = { version = "0.50", optional = true } chrono = { version = "0.4.22", default-features = false, features = ["clock"] } crossbeam-channel = { version = "0.5", optional = true } crossbeam-queue = { version = "0.3", optional = true } -flate2 = { version = "1.0", optional = true } +flate2 = { version = "1.0", optional = true, features = ["rust_backend"] } glob = "0.3" hostname = { version = "0.4", optional = true } log = { version = "0.4", features = ["std"] } diff --git a/src/parameters/age.rs b/src/parameters/age.rs index 75ef648..709d0d9 100644 --- a/src/parameters/age.rs +++ b/src/parameters/age.rs @@ -1,5 +1,5 @@ /// The age after which a log file rotation will be triggered, -/// when [`Criterion::Age`] is chosen. +/// when [Criterion::Age](crate::Criterion::Age) is chosen. #[derive(Copy, Clone, Debug)] pub enum Age { /// Rotate the log file when the local clock has started a new day since the diff --git a/src/writers/syslog/line.rs b/src/writers/syslog/line.rs index dc3b925..0463dd5 100644 --- a/src/writers/syslog/line.rs +++ b/src/writers/syslog/line.rs @@ -30,7 +30,6 @@ impl LineWriter { format: FormatFunction, ) -> IoResult { const UNKNOWN_HOSTNAME: &str = ""; - // FIXME Ok(LineWriter { header, hostname: hostname::get().map_or_else( diff --git a/tests/test_rotate_immediate_compression.rs b/tests/test_rotate_immediate_compression.rs index c8d9235..2ffbda5 100644 --- a/tests/test_rotate_immediate_compression.rs +++ b/tests/test_rotate_immediate_compression.rs @@ -1,7 +1,5 @@ mod test_utils; -#[cfg(feature = "compress")] -use chrono::Local; #[cfg(feature = "compress")] use flexi_logger::{Age, Cleanup, Criterion, Duplicate, FileSpec, Logger, Naming}; #[cfg(feature = "compress")] @@ -47,6 +45,8 @@ fn work(value: u8) { #[cfg(feature = "compress")] fn test_variant(naming: Naming, criterion: Criterion, cleanup: Cleanup) { + use std::time::{Duration, Instant}; + let directory = test_utils::dir(); test_utils::wait_for_start_of_second(); @@ -70,15 +70,17 @@ fn test_variant(naming: Naming, criterion: Criterion, cleanup: Cleanup) { } ); let mut written_lines = 1; - let start = Local::now(); - let duration = chrono::Duration::from_std(std::time::Duration::from_millis(3200)).unwrap(); - while Local::now() - start < duration { + + let start = Instant::now(); + let max_runtime = Duration::from_millis(3_200); + let sleep_time = Duration::from_millis(7); + while Instant::now() - start < max_runtime { written_lines += 1; if written_lines % 17 == 4 { logger.trigger_rotation().unwrap(); } trace!("line_count = {written_lines}"); - std::thread::sleep(std::time::Duration::from_millis(7)); + std::thread::sleep(sleep_time); } std::thread::sleep(std::time::Duration::from_millis(100));