【发布时间】:2016-11-07 16:05:07
【问题描述】:
我在我的应用程序中使用 Timber 和 DebugTree。我想将所有消息记录到 Firebase 崩溃报告中。
Timber.plant(object : Timber.DebugTree() {
override fun log(priority: Int, tag: String?, message: String?, t: Throwable?) {
FirebaseCrash.logcat(priority, tag, message)
}
})
但是现在所有消息都在 logcat 中重复,看起来像这样
11-07 17:08:07.823 V/GoogleApiClientPlugin: Connected to GooglePlayClient
11-07 17:08:07.823 V/GoogleApiClientPlugin: Connected to GooglePlayClient
11-07 17:08:07.824 V/NearbyForegroundService: connected to Google Api Client
11-07 17:08:07.824 V/NearbyForegroundService: connected to Google Api Client
我不想用if (BuildConfig.DEBUG) { ... } 保护通话,因为日志也应该附加到调试版本中发生的崩溃。
Fabric 具有相同的行为,但我可以将记录器设置为静默 .logger(new SilentLogger()),以防止出现重复的日志消息。 Firebase 有 API 吗?
【问题讨论】:
标签: android logcat firebase-crash-reporting timber-android