From cc8e704d5107bd5637e5482ae29145be32e91e26 Mon Sep 17 00:00:00 2001 From: MUEDSA <7676275+muedsa@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:12:18 +0800 Subject: [PATCH] fix: if Timber.d() `args` is empty array, throw UnknownFormatConversionException --- .../main/kotlin/com/muedsa/uitl/LogUtil.kt | 71 +++++++++---------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/app/src/main/kotlin/com/muedsa/uitl/LogUtil.kt b/app/src/main/kotlin/com/muedsa/uitl/LogUtil.kt index 660a5f2..3bd9b7e 100644 --- a/app/src/main/kotlin/com/muedsa/uitl/LogUtil.kt +++ b/app/src/main/kotlin/com/muedsa/uitl/LogUtil.kt @@ -3,41 +3,40 @@ package com.muedsa.uitl import com.google.firebase.crashlytics.FirebaseCrashlytics import timber.log.Timber -class LogUtil { - companion object { - @JvmStatic - fun d(message: String?, vararg args: Any?) { - Timber.d(message, args) - } - - @JvmStatic - fun d(t: Throwable?) { - Timber.d(t) - } - - @JvmStatic - fun d(t: Throwable?, message: String?, vararg args: Any?) { - Timber.d(t, message, args) - } - - @JvmStatic - fun fb(message: String) { - Timber.d(message) - FirebaseCrashlytics.getInstance().log(message) - } - - @JvmStatic - fun fb(t: Throwable) { - Timber.d(t) - FirebaseCrashlytics.getInstance().recordException(t) - } - - @JvmStatic - fun fb(t: Throwable, message: String) { - Timber.d(t, message) - val crashlytics = FirebaseCrashlytics.getInstance() - crashlytics.log(message) - crashlytics.recordException(t) - } +object LogUtil { + + @JvmStatic + fun d(message: String) { + Timber.d(message) + } + + @JvmStatic + fun d(t: Throwable) { + Timber.d(t) + } + + @JvmStatic + fun d(t: Throwable, message: String) { + Timber.d(t, message) + } + + @JvmStatic + fun fb(message: String) { + Timber.d(message) + FirebaseCrashlytics.getInstance().log(message) + } + + @JvmStatic + fun fb(t: Throwable) { + Timber.d(t) + FirebaseCrashlytics.getInstance().recordException(t) + } + + @JvmStatic + fun fb(t: Throwable, message: String) { + Timber.d(t, message) + val crashlytics = FirebaseCrashlytics.getInstance() + crashlytics.log(message) + crashlytics.recordException(t) } } \ No newline at end of file