Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e51cdfe6 authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Improve debug logging format

parent 0eb2bee2
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -53,7 +53,7 @@ class FileLoggingTree @Inject constructor(private val prefs: Preferences) : Timb
            }
            }


            // Format the log to be written to the file
            // Format the log to be written to the file
            val log = "$timestamp $priorityString/$tag: $message ${Log.getStackTraceString(t)}<br>".toByteArray()
            val log = "$timestamp $priorityString/$tag: $message ${Log.getStackTraceString(t)}\n".toByteArray()


            // Ensure that only one thread is writing to the file at a time
            // Ensure that only one thread is writing to the file at a time
            synchronized(fileLock) {
            synchronized(fileLock) {
@@ -62,7 +62,7 @@ class FileLoggingTree @Inject constructor(private val prefs: Preferences) : Timb
                    val dir = File(Environment.getExternalStorageDirectory(), "QKSMS/Logs").apply { mkdirs() }
                    val dir = File(Environment.getExternalStorageDirectory(), "QKSMS/Logs").apply { mkdirs() }


                    // Create the file
                    // Create the file
                    val file = File(dir, "${SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(System.currentTimeMillis())}.html")
                    val file = File(dir, "${SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(System.currentTimeMillis())}.log")


                    // Write the log to the file
                    // Write the log to the file
                    FileOutputStream(file, true).use { fileOutputStream -> fileOutputStream.write(log) }
                    FileOutputStream(file, true).use { fileOutputStream -> fileOutputStream.write(log) }