Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesa2 committed Jun 6, 2024
1 parent d82d052 commit b75df1c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions LogcatCoreLib/src/main/java/info/hannes/timber/DebugFormatTree.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ open class DebugFormatTree(private val newLogcat: Boolean = true) : Timber.Debug
}

// if there is an JSON string, try to print out pretty
override fun logMessage(priority: Int, tag: String?, message: String, t: Throwable?, vararg args: Any?) {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
var localMessage = message.trim()
if (localMessage.startsWith("{") && localMessage.endsWith("}")) {
try {
Expand All @@ -47,6 +47,19 @@ open class DebugFormatTree(private val newLogcat: Boolean = true) : Timber.Debug
} catch (_: JSONException) {
}
}
super.logMessage(priority, tag, "$method: $localMessage", t, args)
super.log(priority, tag, "$method: $localMessage", t)
}

// if there is an JSON string, try to print out pretty
// override fun logMessage(priority: Int, tag: String?, message: String, t: Throwable?, vararg args: Any?) {
// var localMessage = message.trim()
// if (localMessage.startsWith("{") && localMessage.endsWith("}")) {
// try {
// val json = JSONObject(message)
// localMessage = json.toString(3)
// } catch (_: JSONException) {
// }
// }
// super.logMessage(priority, tag, "$method: $localMessage", t, args)
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ open class FileLoggingTree(externalCacheDir: File, context: Context? = null, fil
}

@SuppressLint("LogNotTimber")
override fun logMessage(priority: Int, tag: String?, message: String, t: Throwable?, vararg args: Any?) {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
try {
val logTimeStamp = SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS", Locale.getDefault()).format(Date())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CountlyTree(private val analytics: Analytics, private val serverIgnoreToke
private val t = serverIgnoreToken
private val regex: Regex = "$t.+?$t|$t[^$t]*$".toRegex()

override fun logMessage(priority: Int, tag: String?, message: String, t: Throwable?, vararg args: Any?) {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
// we ignore INFO, DEBUG and VERBOSE
if (priority <= Log.INFO) {
return
Expand Down

0 comments on commit b75df1c

Please sign in to comment.