cleanupExpiredLogs method
清理过期日志
Implementation
Future<void> cleanupExpiredLogs() async {
final dir = _storageDir;
if (dir == null || !await dir.exists()) {
return;
}
final cutoffDate =
DateTime.now().subtract(Duration(days: config.retentionDays));
final logFiles = await _getLogFiles();
for (final file in logFiles) {
if (file.lastModifiedSync().isBefore(cutoffDate)) {
await file.delete();
}
}
}