forked from github/wulkanowy-mirror
Improve firebase logging (#832)
This commit is contained in:
@ -6,20 +6,14 @@ import fr.bipi.tressence.base.FormatterPriorityTree
|
||||
import fr.bipi.tressence.common.StackTraceRecorder
|
||||
import io.github.wulkanowy.sdk.exception.FeatureDisabledException
|
||||
import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException
|
||||
import java.io.InterruptedIOException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
|
||||
class CrashlyticsTree : FormatterPriorityTree(Log.VERBOSE) {
|
||||
|
||||
private val crashlytics by lazy { FirebaseCrashlytics.getInstance() }
|
||||
|
||||
override fun skipLog(priority: Int, tag: String?, message: String, t: Throwable?): Boolean {
|
||||
if (t is FeatureDisabledException || t is FeatureNotAvailableException || t is UnknownHostException) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.skipLog(priority, tag, message, t)
|
||||
}
|
||||
|
||||
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
|
||||
if (skipLog(priority, tag, message, t)) return
|
||||
|
||||
@ -31,6 +25,14 @@ class CrashlyticsExceptionTree : FormatterPriorityTree(Log.ERROR) {
|
||||
|
||||
private val crashlytics by lazy { FirebaseCrashlytics.getInstance() }
|
||||
|
||||
override fun skipLog(priority: Int, tag: String?, message: String, t: Throwable?): Boolean {
|
||||
if (t is FeatureDisabledException || t is FeatureNotAvailableException || t is UnknownHostException || t is SocketTimeoutException || t is InterruptedIOException) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.skipLog(priority, tag, message, t)
|
||||
}
|
||||
|
||||
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
|
||||
if (skipLog(priority, tag, message, t)) return
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.github.wulkanowy.utils
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
@ -24,4 +25,8 @@ class FirebaseAnalyticsHelper @Inject constructor(private val context: Context)
|
||||
analytics.logEvent(name, this)
|
||||
}
|
||||
}
|
||||
|
||||
fun setCurrentScreen(activity: Activity, name: String?) {
|
||||
analytics.setCurrentScreen(activity, name, null)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user