Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions timber/src/main/java/timber/log/Timber.kt
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,17 @@ class Timber private constructor() {
}
}

/**
* A [Tree] for debug builds.
* Automatically shows a Hyperlink to the calling Class and Linenumber in the Logs.
* Allows quick lookup of the caller source just by clicking on the Hyperlink in the Log.
* @param showMethodName Whether or not to show the method name as well
*/
class HyperlinkedDebugTree(private val showMethodName: Boolean = true) : DebugTree() {
override fun createStackElementTag(element: StackTraceElement) =
with(element) { "($fileName:$lineNumber) ${if (showMethodName) " $methodName()" else ""}" }
}

companion object Forest : Tree() {
/** Log a verbose message with optional format args. */
@JvmStatic override fun v(@NonNls message: String?, vararg args: Any?) {
Expand Down