Skip to content

Commit daed75d

Browse files
committed
appender: prune old logs when building the appender for the first time
1 parent 7093adc commit daed75d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tracing-appender/src/rolling.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,9 @@ impl Inner {
666666
max_file_size,
667667
};
668668
let filename = inner.join_date(&now);
669+
if let Some(max_files) = inner.max_files {
670+
inner.prune_old_logs(max_files);
671+
}
669672
let writer = RwLock::new(create_writer(inner.log_directory.as_ref(), &filename)?);
670673
Ok((inner, writer))
671674
}

0 commit comments

Comments
 (0)