Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
CBenoit committed Sep 5, 2023
1 parent 8a5ea2e commit 9efcaec
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tracing-appender/src/rolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub struct RollingFileAppender {
#[derive(Debug)]
pub struct RollingWriter<'a> {
inner: RwLockReadGuard<'a, File>,
current_size: Arc<AtomicU64>,
current_size: &'a AtomicU64,
}

#[derive(Debug)]
Expand Down Expand Up @@ -269,7 +269,7 @@ impl<'a> tracing_subscriber::fmt::writer::MakeWriter<'a> for RollingFileAppender

RollingWriter {
inner: self.writer.read(),
current_size: Arc::clone(&self.state.current_size),
current_size: &self.state.current_size,
}
}
}
Expand Down Expand Up @@ -546,6 +546,22 @@ impl Rotation {
}
}

/// Provides a minutely and size-based rotation.
pub const fn minutely_with_max_bytes(number_of_bytes: u64) -> Self {
Self {
timed: Timed::Minutely,
max_bytes: Some(number_of_bytes),
}
}

/// Provides a hourly and size-based rotation.
pub const fn hourly_with_max_bytes(number_of_bytes: u64) -> Self {
Self {
timed: Timed::Hourly,
max_bytes: Some(number_of_bytes),
}
}

/// Provides a daily and size-based rotation.
pub const fn daily_with_max_bytes(number_of_bytes: u64) -> Self {
Self {
Expand Down

0 comments on commit 9efcaec

Please sign in to comment.