Created
February 21, 2018 12:10
-
-
Save rubdottocom/813feed86842d2d862f528fd8afde902 to your computer and use it in GitHub Desktop.
Logs with links to source code using Awesome Console IntelliJ plugin
This file contains 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
// Works with Awesome Console IntelliJ plugin | |
// https://plugins.jetbrains.com/plugin/7677-awesome-console | |
import timber.log.Timber // https://github.com/JakeWharton/timber | |
class AwesomeTimberLog { | |
fun doLogWithLinkToSourceCode() { | |
Timber.d("Hello World! - " + UtilsK.getLinkToSourceFile(Thread.currentThread().stackTrace[2])) | |
} | |
} |
This file contains 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
class UtilsK { | |
companion object { | |
/** | |
* ste should be Thread.currentThread().stackTrace[2]) | |
*/ | |
@JvmStatic | |
fun getLinkToSourceFile(ste: StackTraceElement): String { | |
return ste.fileName + ":" + ste.lineNumber | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment