diff --git a/LogcatCoreLib/src/main/java/info/hannes/timber/DebugFormatTree.kt b/LogcatCoreLib/src/main/java/info/hannes/timber/DebugFormatTree.kt index cb7afd8a..0468aca0 100644 --- a/LogcatCoreLib/src/main/java/info/hannes/timber/DebugFormatTree.kt +++ b/LogcatCoreLib/src/main/java/info/hannes/timber/DebugFormatTree.kt @@ -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 { @@ -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) +// } } diff --git a/LogcatCoreLib/src/main/java/info/hannes/timber/FileLoggingTree.kt b/LogcatCoreLib/src/main/java/info/hannes/timber/FileLoggingTree.kt index 6e8c337e..f2085d76 100644 --- a/LogcatCoreLib/src/main/java/info/hannes/timber/FileLoggingTree.kt +++ b/LogcatCoreLib/src/main/java/info/hannes/timber/FileLoggingTree.kt @@ -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()) diff --git a/LogcatCountlyLib/src/main/java/info/hannes/timber/CountlyTree.kt b/LogcatCountlyLib/src/main/java/info/hannes/timber/CountlyTree.kt index 7e946512..70180632 100644 --- a/LogcatCountlyLib/src/main/java/info/hannes/timber/CountlyTree.kt +++ b/LogcatCountlyLib/src/main/java/info/hannes/timber/CountlyTree.kt @@ -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