Updated on 2026-08-14
This commit is contained in:
parent
646d33dfa2
commit
52fa99023d
4 changed files with 18 additions and 2 deletions
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue