aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-08-04 22:56:03 -0700
committerGitHub <noreply@github.com>2019-08-04 22:56:03 -0700
commit2eacc8cb77b561eb1da11acb6ec8f620195fd24f (patch)
tree6eca0acb160f1b6696f4b225c4e4eb9f46644943 /app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt
parent3dcf1e1f697b06a88876a183bacf5b67f0d0e8dd (diff)
parentdd391481881683e7b58a69ef2b9b671fb6197208 (diff)
downloadfrost-2eacc8cb77b561eb1da11acb6ec8f620195fd24f.tar.gz
frost-2eacc8cb77b561eb1da11acb6ec8f620195fd24f.tar.bz2
frost-2eacc8cb77b561eb1da11acb6ec8f620195fd24f.zip
Merge pull request #1496 from AllanWang/bugsnag-opt-out
Bugsnag opt out
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt26
1 files changed, 19 insertions, 7 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 7c8c1895..dd8cf594 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt
@@ -41,28 +41,40 @@ object L : KauLogger("Frost", {
}
inline fun _i(message: () -> Any?) {
- if (BuildConfig.DEBUG)
+ if (BuildConfig.DEBUG) {
i(message)
+ }
}
inline fun _d(message: () -> Any?) {
- if (BuildConfig.DEBUG)
+ if (BuildConfig.DEBUG) {
d(message)
+ }
}
inline fun _e(e: Throwable?, message: () -> Any?) {
- if (BuildConfig.DEBUG)
+ if (BuildConfig.DEBUG) {
e(e, message)
+ }
}
+ var bugsnagInit = false
+
override fun logImpl(priority: Int, message: String?, t: Throwable?) {
- if (BuildConfig.DEBUG)
+ /*
+ * Debug flag is constant and should help with optimization
+ * 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) {
super.logImpl(priority, message, t)
- else {
- if (message != null)
+ } else {
+ if (message != null) {
Bugsnag.leaveBreadcrumb(message)
- if (t != null)
+ }
+ if (t != null) {
Bugsnag.notify(t)
+ }
}
}
}