Communicate bad messages to main process

This commit is contained in:
Mygod
2020-07-07 07:58:35 +08:00
parent 05fead2431
commit 95ff4bc91c

View File

@@ -19,11 +19,13 @@ object RootManager : RootSession() {
RootServer.DEBUG = BuildConfig.DEBUG RootServer.DEBUG = BuildConfig.DEBUG
Timber.plant(object : Timber.DebugTree() { Timber.plant(object : Timber.DebugTree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (priority >= Log.WARN) System.err.println("$priority/$tag: $message")
if (t == null) { if (t == null) {
Log.println(priority, tag, message) Log.println(priority, tag, message)
} else { } else {
Log.println(priority, tag, message) Log.println(priority, tag, message)
Log.d(tag, message, t) Log.d(tag, message, t)
if (priority >= Log.WARN) t.printStackTrace(System.err)
} }
} }
}) })