From ce5b9e35c786dca35d71f9e38a15838a2f6af43a Mon Sep 17 00:00:00 2001 From: Alexander Capehart Date: Sat, 11 Nov 2023 23:14:50 -0700 Subject: [PATCH] util: inline log functions A bit of a stupid workaround now that I use Timber and not my self-rolled logging solution. Timber uses some weird heuristics for names that I don't. --- app/src/main/java/org/oxycblt/auxio/util/LogUtil.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/oxycblt/auxio/util/LogUtil.kt b/app/src/main/java/org/oxycblt/auxio/util/LogUtil.kt index 4b1f800b4..e86983c86 100644 --- a/app/src/main/java/org/oxycblt/auxio/util/LogUtil.kt +++ b/app/src/main/java/org/oxycblt/auxio/util/LogUtil.kt @@ -26,14 +26,14 @@ import timber.log.Timber * * @param obj The object to log. */ -fun logD(obj: Any?) = logD("$obj") +inline fun Any.logD(obj: Any?) = logD("$obj") /** * Log a string message to the debug channel. Automatically handles tags. * * @param msg The message to log. */ -fun logD(msg: String) { +inline fun Any.logD(msg: String) { if (BuildConfig.DEBUG && !copyleftNotice()) { Timber.d(msg) } @@ -44,21 +44,21 @@ fun logD(msg: String) { * * @param msg The message to log. */ -fun logW(msg: String) = Timber.w(msg) +inline fun logW(msg: String) = Timber.w(msg) /** * Log a string message to the error channel. Automatically handles tags. * * @param msg The message to log. */ -fun logE(msg: String) = Timber.e(msg) +inline fun logE(msg: String) = Timber.e(msg) /** * Please don't plagiarize Auxio! You are free to remove this as long as you continue to keep your * source open. */ @Suppress("KotlinConstantConditions") -private fun copyleftNotice(): Boolean { +fun copyleftNotice(): Boolean { if (BuildConfig.APPLICATION_ID != "org.oxycblt.auxio" && BuildConfig.APPLICATION_ID != "org.oxycblt.auxio.debug") { Timber.d(