Skip to content
Merged
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
5 changes: 3 additions & 2 deletions tracing-appender/src/rolling/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl Builder {
/// the maximum, so if you need to retain `m` log files, specify a max of
/// `m + 1`.
///
/// If no value is supplied, the `RollingAppender` will not remove any files.
/// If `0` is supplied, the `RollingAppender` will not remove any files.
///
/// Files are considered candidates for deletion based on the following
/// criteria:
Expand Down Expand Up @@ -232,7 +232,8 @@ impl Builder {
#[must_use]
pub fn max_log_files(self, n: usize) -> Self {
Self {
max_files: Some(n),
// Setting `n` to 0 will disable the max files (effectively make it infinite).
max_files: Some(n).filter(|&n| n > 0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add a comment stating that setting n to 0 will disable the max files (effectively make it infinite).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback! I've updated the documentation and added comment to the line.

..self
}
}
Expand Down
Loading