printStackTrace

Prints the detailed description of this throwable to the standard output or standard error output.

expect fun Throwable.printStackTrace()(source)
fun main() {
    try {
        // This will throw an IndexOutOfBoundsException
        val list = listOf<Int>()
        println(list[1])
    } catch (e: Exception) {
        // Print the stack trace to standard error
        e.printStackTrace()
    }
}

Source