fix(logs): §C+E · purge dead code 활성화 + record() 통합 관문 (cloud-mvp d8425d0 이식)

This commit is contained in:
2026-08-04 16:18:07 +09:00
parent 4d8ada0634
commit 253312b4b0
4 changed files with 95 additions and 0 deletions
@@ -121,4 +121,21 @@ object AdcCsvLogger {
}
} catch (_: Exception) {}
}
/**
* VesiScan_ADC/ 폴더의 keepDays 일 이전 CSV 삭제 (§C purge).
* 2026-08-04: LOG_STORAGE_ANALYSIS Priority 3 — 시간당 40MB 누적 방지.
*/
fun purgeOldSessions(keepDays: Int = 30) {
try {
val calendar = Calendar.getInstance()
calendar.add(Calendar.DAY_OF_YEAR, -keepDays)
val cutoff = SimpleDateFormat("yyyy-MM-dd", Locale.US).format(calendar.time)
val dir = getDir()
dir.listFiles { f -> f.extension == "csv" }?.forEach { file ->
val prefix = file.nameWithoutExtension.take(10)
if (prefix < cutoff) file.delete()
}
} catch (_: Exception) { }
}
}