aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-02-23 16:47:57 -0800
committerAllan Wang <me@allanwang.ca>2020-02-23 16:47:57 -0800
commit44de8239ec7d9e6b79194647829863d176123379 (patch)
treee480162a7efa66420fa1eebcada57d6eba769c44 /app/src/main/kotlin/com/pitchedapps/frost/utils
parent0dfc1b3e6542b9deca6c56236b46e71e4c6976f5 (diff)
downloadfrost-44de8239ec7d9e6b79194647829863d176123379.tar.gz
frost-44de8239ec7d9e6b79194647829863d176123379.tar.bz2
frost-44de8239ec7d9e6b79194647829863d176123379.zip
Remove pref component from logger
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt17
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt4
2 files changed, 7 insertions, 14 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt
index 393df763..974047e8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt
@@ -16,28 +16,17 @@
*/
package com.pitchedapps.frost.utils
-import android.util.Log
import ca.allanwang.kau.logging.KauLogger
import ca.allanwang.kau.logging.KauLoggerExtension
import com.bugsnag.android.Bugsnag
import com.pitchedapps.frost.BuildConfig
-import org.koin.core.KoinComponent
-import org.koin.core.inject
/**
* Created by Allan Wang on 2017-05-28.
*
* Logging for frost
*/
-object L : KauLogger("Frost", {
- when (it) {
- Log.VERBOSE -> BuildConfig.DEBUG
- Log.INFO, Log.ERROR -> true
- else -> BuildConfig.DEBUG || L.prefs.verboseLogging
- }
-}), KoinComponent {
-
- private val prefs: Prefs by inject()
+object L : KauLogger("Frost") {
inline fun test(message: () -> Any?) {
_d {
@@ -63,7 +52,7 @@ object L : KauLogger("Frost", {
}
}
- var bugsnagInit = false
+ var hasAnalytics: () -> Boolean = { false }
override fun logImpl(priority: Int, message: String?, t: Throwable?) {
/*
@@ -71,7 +60,7 @@ object L : KauLogger("Frost", {
* bugsnagInit is changed per application and helps prevent crashes (if calling pre init)
* analytics is changed by the user, and may be toggled throughout the app
*/
- if (BuildConfig.DEBUG || !bugsnagInit || !prefs.analytics) {
+ if (BuildConfig.DEBUG || !hasAnalytics()) {
super.logImpl(priority, message, t)
} else {
if (message != null) {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
index 3d394abe..8052533b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -158,6 +158,10 @@ class Prefs(factory: KPrefFactory) : KPref("${BuildConfig.APPLICATION_ID}.prefs"
var enablePip: Boolean by kpref("enable_pip", true)
+ /**
+ * Despite the naming, this toggle currently only enables debug logging.
+ * Verbose is never logged in release builds.
+ */
var verboseLogging: Boolean by kpref("verbose_logging", false)
var analytics: Boolean by kpref("analytics", false) {