mirror of
https://github.com/HighCapable/YukiReflection.git
synced 2025-09-06 10:45:46 +08:00
style: rename toStackTrack to dumpToString
This commit is contained in:
@@ -51,7 +51,6 @@ import com.highcapable.yukireflection.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukireflection.utils.debug.YukiLog
|
||||
import com.highcapable.yukireflection.utils.factory.await
|
||||
import com.highcapable.yukireflection.utils.factory.runBlocking
|
||||
import com.highcapable.yukireflection.utils.factory.toStackTrace
|
||||
import dalvik.system.BaseDexClassLoader
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Field
|
||||
@@ -93,7 +92,7 @@ class DexClassFinder @PublishedApi internal constructor(
|
||||
?.let { "${CACHE_FILE_NAME}_${versionName ?: it.versionName}_${versionCode ?: runCatching { it.longVersionCode }.getOrNull() ?: it.versionCode}" }
|
||||
?: "${CACHE_FILE_NAME}_unknown",
|
||||
Context.MODE_PRIVATE)
|
||||
}.onFailure { YukiLog.warn(msg = "Failed to read app's SharedPreferences when using DexClassFinder\n${it.toStackTrace()}") }.getOrNull()
|
||||
}.onFailure { YukiLog.warn(msg = "Failed to read app's SharedPreferences when using DexClassFinder", e = it) }.getOrNull()
|
||||
|
||||
/**
|
||||
* 清除当前 [DexClassFinder] 的 [Class] 缓存
|
||||
|
@@ -30,7 +30,7 @@ package com.highcapable.yukireflection.utils.debug
|
||||
import android.util.Log
|
||||
import com.highcapable.yukireflection.YukiReflection
|
||||
import com.highcapable.yukireflection.factory.hasClass
|
||||
import com.highcapable.yukireflection.utils.factory.toStackTrace
|
||||
import com.highcapable.yukireflection.utils.factory.dumpToString
|
||||
|
||||
/**
|
||||
* 全局 Log 管理类
|
||||
@@ -112,6 +112,6 @@ internal object YukiLog {
|
||||
*/
|
||||
fun innerLog(msg: String) = if (color.isBlank()) println(msg) else println("\u001B[${color}m$msg\u001B[0m")
|
||||
innerLog(msg)
|
||||
e?.also { innerLog(it.toStackTrace()) }
|
||||
e?.also { innerLog(it.dumpToString()) }
|
||||
}
|
||||
}
|
@@ -33,7 +33,7 @@ import java.io.ByteArrayOutputStream
|
||||
import java.io.PrintStream
|
||||
|
||||
/**
|
||||
* 获取完整的异常堆栈内容
|
||||
* 写出异常堆栈到字符串
|
||||
* @return [String]
|
||||
*/
|
||||
internal fun Throwable.toStackTrace() = ByteArrayOutputStream().also { printStackTrace(PrintStream(it)) }.toString()
|
||||
internal fun Throwable.dumpToString() = ByteArrayOutputStream().also { printStackTrace(PrintStream(it)) }.toString()
|
Reference in New Issue
Block a user