aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca/allanwang/kau/logging/TimberLogger.kt
blob: 5969fd5651d39fb4e2061377f2f3b93641080a4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package ca.allanwang.kau.logging

import timber.log.Timber


/**
 * Created by Allan Wang on 2017-05-28.
 *
 * Timber extension that will embed the tag as part of the message for each log item
 */
open class TimberLogger(tag: String) {
    internal val TAG = "$tag: %s"
    fun e(s: String) = Timber.e(TAG, s)
    fun e(t: Throwable, s: String = "error") = Timber.e(t, TAG, s)
    fun d(s: String) = Timber.d(TAG, s)
    fun i(s: String) = Timber.i(TAG, s)
    fun v(s: String) = Timber.v(TAG, s)
    fun eThrow(s: String) = e(Throwable(s))
}