Skip to content

Commit

Permalink
appender: prune old logs when building the appender for the first time
Browse files Browse the repository at this point in the history
  • Loading branch information
x3ccd4828 committed Jan 30, 2025
1 parent 6df9eb5 commit 65851cd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tracing-appender/src/rolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ impl Inner {
max_file_size,
};
let filename = inner.join_date(&now);
if let Some(max_files) = inner.max_files {
inner.prune_old_logs(max_files);
}
let writer = RwLock::new(create_writer(inner.log_directory.as_ref(), &filename)?);
Ok((inner, writer))
}
Expand Down

0 comments on commit 65851cd

Please sign in to comment.