Skip to content

Commit

Permalink
Merge pull request #36 from Qase/feature/delete-logs-for-identifier
Browse files Browse the repository at this point in the history
FEAT: add option to remove logs created by file logger using logIdent…
  • Loading branch information
balakzde committed Jun 24, 2024
2 parents 27c2d57 + 1751739 commit 112b241
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kotlinlog/src/main/kotlin/quanti/com/kotlinlog/file/FileLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ class FileLogger(

companion object {

/**
* Deletes all stored logs in app local memory
*/
fun deleteLogsForIdentifier(appCtx: Context, logIdentifier: String) {
appCtx
.logFilesDir
.listFiles()
.filter { it.name.contains(logIdentifier) }
.filter { it.name.endsWith(".log") }
.forEach { it.delete() }
}
/**
* Deletes all stored logs in app local memory
*/
Expand Down

0 comments on commit 112b241

Please sign in to comment.