mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-05 18:25:28 +08:00
Added Throwable.toStackTrace function in UtilsFactory
This commit is contained in:
@@ -27,6 +27,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.highcapable.yukihookapi.hook.utils
|
package com.highcapable.yukihookapi.hook.utils
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.PrintStream
|
||||||
import java.util.concurrent.ExecutorService
|
import java.util.concurrent.ExecutorService
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
@@ -85,6 +87,12 @@ internal inline fun <T> T.takeIf(other: Any?, predicate: (T) -> Boolean) = if (o
|
|||||||
*/
|
*/
|
||||||
internal inline fun <T, R> T.let(other: Any?, block: (T) -> R) = if (other != null) let(block) else null
|
internal inline fun <T, R> T.let(other: Any?, block: (T) -> R) = if (other != null) let(block) else null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取完整的异常堆栈内容
|
||||||
|
* @return [String]
|
||||||
|
*/
|
||||||
|
internal fun Throwable.toStackTrace() = ByteArrayOutputStream().also { printStackTrace(PrintStream(it)) }.toString()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算方法执行耗时
|
* 计算方法执行耗时
|
||||||
* @param block 方法块
|
* @param block 方法块
|
||||||
|
Reference in New Issue
Block a user