Skip to content

Commit

Permalink
enable logging by delegation
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesa2 committed Jul 15, 2022
1 parent 9954d94 commit 7a942ba
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions timber/src/main/java/timber/log/Timber.kt
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,18 @@ class Timber private constructor() {
}

/** A [Tree] for debug builds. Automatically infers the tag from the calling class. */
open class DebugTree : Tree() {
private val fqcnIgnore = listOf(
Timber::class.java.name,
Timber.Forest::class.java.name,
Tree::class.java.name,
DebugTree::class.java.name
)
open class DebugTree(delegator: Class<*>? = null) : Tree() {

private val fqcnIgnore : MutableList<String> = listOf(
Timber::class.java.name,
Timber.Forest::class.java.name,
Tree::class.java.name,
DebugTree::class.java.name
).toMutableList()

init {
delegator?.let { fqcnIgnore.add(it.name) }
}

override val tag: String?
get() = super.tag ?: Throwable().stackTrace
Expand Down

0 comments on commit 7a942ba

Please sign in to comment.