Fix logging

This commit is contained in:
Mygod
2018-10-03 13:28:44 +08:00
parent 8e09e8cd8a
commit 55405742a8
2 changed files with 4 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
if (getGradle().getStartParameter().getTaskRequests().toString().contains("base")) if (getGradle().getStartParameter().getTaskRequests().toString().contains("Base"))
apply plugin: 'io.fabric' apply plugin: 'io.fabric'
android { android {
@@ -76,5 +76,5 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
} }
if (getGradle().getStartParameter().getTaskRequests().toString().contains("base")) if (getGradle().getStartParameter().getTaskRequests().toString().contains("Base"))
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'

View File

@@ -8,7 +8,7 @@ import timber.log.Timber
fun initTimber() { fun initTimber() {
Fabric.with(app, Crashlytics()) Fabric.with(app, Crashlytics())
Timber.plant(object : Timber.Tree() { 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 (t == null) Crashlytics.log(priority, tag, message) else { if (t == null) Crashlytics.log(priority, tag, message) else {
// Crashlytics.logException doesn't print to logcat // Crashlytics.logException doesn't print to logcat
@@ -20,6 +20,6 @@ fun initTimber() {
} }
fun debugLog(tag: String?, message: String?) { fun debugLog(tag: String?, message: String?) {
if (BuildConfig.DEBUG) Timber.d(tag, message) if (BuildConfig.DEBUG) Timber.tag(tag).d(message)
Crashlytics.log("$tag: $message") Crashlytics.log("$tag: $message")
} }