Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-27 16:01:01 +03:00
parent 646d33dfa2
commit 52fa99023d
4 changed files with 18 additions and 2 deletions

View file

@ -38,7 +38,7 @@ class AppLogsStore @Inject constructor(
)
private val mutex = Mutex()
private val file = File(applicationContext.filesDir, LOG_FILE_NAME)
private val file = File(applicationContext.filesDir, NEW_LOG_FILE_NAME)
private val formatter = DateTimeFormatterBuilder()
.appendDayOfMonth(2)
@ -84,6 +84,12 @@ class AppLogsStore @Inject constructor(
}
}
fun deleteOldLogsFile() {
val file = File(applicationContext.filesDir, LOG_FILE_NAME)
if (file.exists()) file.delete()
}
private fun writeMessage(vararg messages: String) {
BufferedWriter(FileWriter(file, true)).use { writer ->
writer.append(formatter.print(DateTime.now()))
@ -112,5 +118,6 @@ class AppLogsStore @Inject constructor(
private companion object {
const val LOG_FILE_NAME = "logs.txt"
const val NEW_LOG_FILE_NAME = "app_logs.txt"
}
}