Last active
September 28, 2017 12:00
-
-
Save nodinosaur/f92773a5ff331dab58bf1baa00c37d1a to your computer and use it in GitHub Desktop.
Timber debug Tree that has a clickable Android Studio Link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package xyz.androidalliance.logs | |
import timber.log.Timber | |
class AndroidDebugTree : Timber.DebugTree() { | |
override fun createStackElementTag(element: StackTraceElement): String { | |
// returns a clickable Android Studio link | |
return String.format("\n%4\$s .%1\$s(%2\$s:%3\$s)\n\n", | |
element.methodName, | |
element.fileName, | |
element.lineNumber, | |
super.createStackElementTag(element)) | |
} | |
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { | |
println(String.format("%2\$s %1\$s", tag, message)) | |
t?.printStackTrace(System.out) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment