diff options
author | Allan Wang <me@allanwang.ca> | 2019-08-04 23:00:22 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-08-04 23:00:22 -0700 |
commit | 8142d99f3b757c856d1ec692ffd2dac5e8e4a8e0 (patch) | |
tree | 11fbadaf1e72ffd44f6136a13a646f1488e24410 /app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt | |
parent | ba4b15a7ff47ac48008247f4abd36b3025cab66c (diff) | |
parent | 2eacc8cb77b561eb1da11acb6ec8f620195fd24f (diff) | |
download | frost-8142d99f3b757c856d1ec692ffd2dac5e8e4a8e0.tar.gz frost-8142d99f3b757c856d1ec692ffd2dac5e8e4a8e0.tar.bz2 frost-8142d99f3b757c856d1ec692ffd2dac5e8e4a8e0.zip |
Merge branch 'dev' into theme
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.kt | 26 |
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) + } } } } |