Add timber for debugging

Timber seems better for debugging compared to Log as there is no necessity of adding a TAG.
pull/212/head
oyeraghib 3 years ago
parent 4a0fbf99b2
commit 64ca6bd507

@ -127,6 +127,9 @@ dependencies {
kapt(libs.hilt.compiler)
kaptAndroidTest(libs.hilt.compiler)
//Timber
implementation("com.jakewharton.timber:timber:5.0.1")
// androidx.test is forcing JUnit, 4.12. This forces it to use 4.13
configurations.configureEach {
resolutionStrategy {

@ -22,6 +22,7 @@ import coil.ImageLoaderFactory
import coil.decode.SvgDecoder
import com.google.samples.apps.nowinandroid.sync.initializers.Sync
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber
/**
* [Application] class for NiA
@ -32,6 +33,9 @@ class NiaApplication : Application(), ImageLoaderFactory {
super.onCreate()
// Initialize Sync; the system responsible for keeping data in the app up to date.
Sync.initialize(context = this)
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}
/**

@ -17,7 +17,6 @@
package com.google.samples.apps.nowinandroid.di
import android.app.Activity
import android.util.Log
import android.view.Window
import androidx.metrics.performance.JankStats
import dagger.Module
@ -27,6 +26,7 @@ import dagger.hilt.android.components.ActivityComponent
import java.util.concurrent.Executor
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.asExecutor
import timber.log.Timber
@Module
@InstallIn(ActivityComponent::class)
@ -37,7 +37,7 @@ object JankStatsModule {
// Make sure to only log janky frames.
if (frameData.isJank) {
// We're currently logging this but would better report it to a backend.
Log.v("NiA Jank", frameData.toString())
Timber.v(frameData.toString())
}
}
}

Loading…
Cancel
Save