Skip to content

Commit

Permalink
added timestamp to error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
artemperl committed Jun 4, 2017
1 parent 5b9fbbf commit a7dda53
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import java.io.File
import java.io.FileWriter
import java.io.PrintWriter
import java.util.*

private const val ERROR_LOG_FILE = "errors.txt"
private const val DEFAULT_MAX_LINES = 1000
Expand All @@ -14,6 +15,7 @@ fun Context.logError(e: Throwable) {

val writer = PrintWriter(FileWriter(errorLog, true))
writer.appendln(SEPERATOR)
writer.appendln(Date(System.currentTimeMillis()).toString())
e.printStackTrace(writer)
writer.close()

Expand Down

0 comments on commit a7dda53

Please sign in to comment.