Files
TachiyomiSY/app/src/main/java/exh/log/CrashlyticsPrinter.kt
T
2025-11-16 18:07:44 +05:45

27 lines
778 B
Kotlin

package exh.log
import com.elvishew.xlog.printer.Printer
import com.google.firebase.crashlytics.crashlytics
import com.google.firebase.Firebase
import eu.kanade.tachiyomi.BuildConfig
class CrashlyticsPrinter(private val logLevel: Int) : Printer {
/**
* Print log in new line.
*
* @param logLevel the level of log
* @param tag the tag of log
* @param msg the msg of log
*/
override fun println(logLevel: Int, tag: String?, msg: String?) {
if (logLevel >= this.logLevel) {
try {
Firebase.crashlytics.log("$logLevel/$tag: $msg")
} catch (t: Throwable) {
// Crash in debug if shit like this happens
if (BuildConfig.DEBUG) throw t
}
}
}
}