Fix PersistentTree logging to append

This commit is contained in:
William Brawner 2021-02-21 17:29:02 -07:00
parent 31e81f31b4
commit 260c49d8d5

View file

@ -8,6 +8,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import timber.log.Timber import timber.log.Timber
import java.io.File import java.io.File
import java.io.FileOutputStream
import java.io.IOException import java.io.IOException
import java.io.PrintStream import java.io.PrintStream
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
@ -35,7 +36,7 @@ class PersistentTree private constructor(private val logFile: File) : Timber.Tre
Log.WARN -> "W" Log.WARN -> "W"
else -> "U" else -> "U"
} }
logFile.outputStream().use { stream -> FileOutputStream(logFile, true).use { stream ->
stream.bufferedWriter().use { stream.bufferedWriter().use {
it.appendLine("$timestamp $priorityLetter/${tag ?: "SimpleMarkdown"}: $message") it.appendLine("$timestamp $priorityLetter/${tag ?: "SimpleMarkdown"}: $message")
} }