diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-30 10:36:38 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-30 10:36:38 -0700 |
commit | 7267064d8a007e49bf05c3fc68b6338209a7c784 (patch) | |
tree | 676f2ab385b975f6ffd9b534fc8bcc11ac542635 /app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt | |
parent | a42519030892ede729fc37ce6cbc93bb1d80989c (diff) | |
download | frost-7267064d8a007e49bf05c3fc68b6338209a7c784.tar.gz frost-7267064d8a007e49bf05c3fc68b6338209a7c784.tar.bz2 frost-7267064d8a007e49bf05c3fc68b6338209a7c784.zip |
Remove user info in debug logs
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 | 30 |
1 files changed, 26 insertions, 4 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 d9ce828e..dcf97265 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt @@ -8,14 +8,36 @@ import timber.log.Timber /** * Created by Allan Wang on 2017-05-28. + * + * Logging for frost + * + * To ensure privacy, the following rules are set: + * + * Debug and Error logs must not reveal person info + * Person info logs can be marked as info or verbose */ -object L : TimberLogger("Frost") +object L : TimberLogger("Frost") { + + /** + * Helper function to separate private info + */ + fun d(tag: String, personal: String?) { + L.d(tag) + if (personal != null) L.i(personal) + } +} internal class CrashReportingTree : Timber.Tree() { override fun log(priority: Int, tag: String?, message: String?, t: Throwable?) { - if (priority == Log.VERBOSE || priority == Log.DEBUG) - return - if (message != null) Crashlytics.log(priority, tag ?: "Frost", message) + when (priority) { + Log.VERBOSE, Log.INFO -> return + Log.DEBUG -> if (!Prefs.verboseLogging) return + } + if (message != null) + if (priority == Log.ERROR) + Crashlytics.log(Log.ERROR, "Frost", message) + else + Crashlytics.log(message) if (t != null) Crashlytics.logException(t) } }
\ No newline at end of file |