Skip to content

Instantly share code, notes, and snippets.

@olivierperez
Created January 9, 2020 14:26
Show Gist options
  • Save olivierperez/d2f8ae52de193f6f948070d7474c19d9 to your computer and use it in GitHub Desktop.
Save olivierperez/d2f8ae52de193f6f948070d7474c19d9 to your computer and use it in GitHub Desktop.
Debug - CallStack
fun buildCallStack(): String {
return Exception().stackTrace
.asSequence()
.filter {
!it.className.startsWith("fr.o80.corelib") &&
!it.className.startsWith("io.reactivex") &&
"rxext" !in it.fileName.toLowerCase(Locale.FRENCH)&&
"MyDebuggerClass" !in it.className
}
.take(4)
.fold(StringBuilder()) { acc, it ->
acc.append("${it.className}.${it.methodName}(${it.fileName}:${it.lineNumber})")
.append(" < ")
}
.toString()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment