blob: 4f31f5f5c812d107a6d544a5dad1592f85f71d7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package com.pitchedapps.frost.utils
import android.util.Log
import ca.allanwang.kau.logging.KauLogger
import com.bugsnag.android.Bugsnag
import com.pitchedapps.frost.BuildConfig
/**
* 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 || Prefs.verboseLogging
}
}) {
inline fun _i(message: () -> Any?) {
if (BuildConfig.DEBUG)
i(message)
}
inline fun _d(message: () -> Any?) {
if (BuildConfig.DEBUG)
d(message)
}
override fun logImpl(priority: Int, message: String?, t: Throwable?) {
if (BuildConfig.DEBUG)
super.logImpl(priority, message, t)
else {
if (message != null)
Bugsnag.leaveBreadcrumb(message)
if (t != null)
Bugsnag.notify(t)
}
}
}
|