refactor: rename YukiLog to YLog

This commit is contained in:
2023-09-27 20:00:36 +08:00
parent c0a1ab0e1d
commit 3a0c8cfef6
8 changed files with 24 additions and 24 deletions

View File

@@ -29,7 +29,7 @@
package com.highcapable.yukireflection.finder.base
import com.highcapable.yukireflection.YukiReflection
import com.highcapable.yukireflection.utils.debug.YukiLog
import com.highcapable.yukireflection.utils.debug.YLog
/**
* 这是 [Class] 查找类功能的基本类实现
@@ -62,7 +62,7 @@ abstract class ClassBaseFinder internal constructor(internal open val loaderSet:
* @param msg 消息内容
*/
internal fun debugMsg(msg: String) {
if (YukiReflection.Configs.isDebug) YukiLog.debug(msg)
if (YukiReflection.Configs.isDebug) YLog.debug(msg)
}
/**
@@ -73,7 +73,7 @@ abstract class ClassBaseFinder internal constructor(internal open val loaderSet:
if (isIgnoreErrorLogs) return
/** 判断是否为 [LOADERSET_IS_NULL] */
if (e?.message == LOADERSET_IS_NULL) return
YukiLog.error(msg = "NoClassDefFound happend in [$loaderSet]", e = e)
YLog.error(msg = "NoClassDefFound happend in [$loaderSet]", e = e)
}
override fun failure(throwable: Throwable?) = error("DexClassFinder does not contain this usage")

View File

@@ -31,7 +31,7 @@
package com.highcapable.yukireflection.finder.base
import com.highcapable.yukireflection.YukiReflection
import com.highcapable.yukireflection.utils.debug.YukiLog
import com.highcapable.yukireflection.utils.debug.YLog
import com.highcapable.yukireflection.utils.factory.await
import java.lang.reflect.Constructor
import java.lang.reflect.Field
@@ -92,7 +92,7 @@ abstract class MemberBaseFinder internal constructor(private val tag: String, in
* @param msg 消息内容
*/
internal fun debugMsg(msg: String) {
if (YukiReflection.Configs.isDebug) YukiLog.debug(msg)
if (YukiReflection.Configs.isDebug) YLog.debug(msg)
}
/**
@@ -108,8 +108,8 @@ abstract class MemberBaseFinder internal constructor(private val tag: String, in
await {
if (isIgnoreErrorLogs) return@await
if (isAlwaysMode.not() && isUsingRemedyPlan) return@await
YukiLog.error(msg = "NoSuch$tag happend in [$classSet] $msg".trim(), e = e)
es.forEachIndexed { index, e -> YukiLog.error(msg = "Throwable [${index + 1}]", e = e) }
YLog.error(msg = "NoSuch$tag happend in [$classSet] $msg".trim(), e = e)
es.forEachIndexed { index, e -> YLog.error(msg = "Throwable [${index + 1}]", e = e) }
}
}
}

View File

@@ -47,7 +47,7 @@ import com.highcapable.yukireflection.finder.classes.rules.result.MemberRulesRes
import com.highcapable.yukireflection.finder.tools.ReflectionTool
import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
import com.highcapable.yukireflection.finder.type.factory.NameConditions
import com.highcapable.yukireflection.utils.debug.YukiLog
import com.highcapable.yukireflection.utils.debug.YLog
import com.highcapable.yukireflection.utils.factory.await
import com.highcapable.yukireflection.utils.factory.runBlocking
import dalvik.system.BaseDexClassLoader
@@ -91,7 +91,7 @@ class DexClassFinder 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", e = it) }.getOrNull()
}.onFailure { YLog.warn(msg = "Failed to read app's SharedPreferences when using DexClassFinder", e = it) }.getOrNull()
/**
* 清除当前 [DexClassFinder] 的 [Class] 缓存
@@ -102,7 +102,7 @@ class DexClassFinder internal constructor(
* @param versionCode 版本号 - 默认空
*/
fun clearCache(context: Context, versionName: String? = null, versionCode: Long? = null) =
context.currentSp(versionName, versionCode)?.edit()?.clear()?.apply() ?: YukiLog.warn(msg = "Failed to clear DexClassFinder's cache")
context.currentSp(versionName, versionCode)?.edit()?.clear()?.apply() ?: YLog.warn(msg = "Failed to clear DexClassFinder's cache")
}
override var rulesData = ClassRulesData()
@@ -451,7 +451,7 @@ class DexClassFinder internal constructor(
takeIf { it.isNotEmpty() }?.forEach { names.add(it.name) }
context?.also {
if (it.packageName == "android") error("Cannot create classes cache for \"android\", please remove \"name\" param")
it.currentSp()?.edit()?.apply { putStringSet(name, names) }?.apply() ?: YukiLog.warn(msg = "Failed to use caching in DexClassFinder")
it.currentSp()?.edit()?.apply { putStringSet(name, names) }?.apply() ?: YLog.warn(msg = "Failed to use caching in DexClassFinder")
}
}
}

View File

@@ -42,7 +42,7 @@ import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
import com.highcapable.yukireflection.finder.type.factory.ObjectsConditions
import com.highcapable.yukireflection.type.defined.UndefinedType
import com.highcapable.yukireflection.type.defined.VagueType
import com.highcapable.yukireflection.utils.debug.YukiLog
import com.highcapable.yukireflection.utils.debug.YLog
import com.highcapable.yukireflection.utils.factory.runBlocking
import java.lang.reflect.Constructor
@@ -304,7 +304,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
if (isFindSuccess) return
errorMsg(msg = "RemedyPlan failed after ${remedyPlans.size} attempts", es = errors, isAlwaysMode = true)
remedyPlans.clear()
} else YukiLog.warn(msg = "RemedyPlan is empty, forgot it?")
} else YLog.warn(msg = "RemedyPlan is empty, forgot it?")
}
/**

View File

@@ -42,7 +42,7 @@ import com.highcapable.yukireflection.finder.type.factory.FieldConditions
import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
import com.highcapable.yukireflection.finder.type.factory.NameConditions
import com.highcapable.yukireflection.finder.type.factory.ObjectConditions
import com.highcapable.yukireflection.utils.debug.YukiLog
import com.highcapable.yukireflection.utils.debug.YLog
import com.highcapable.yukireflection.utils.factory.runBlocking
import java.lang.reflect.Field
@@ -262,7 +262,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
if (isFindSuccess) return
errorMsg(msg = "RemedyPlan failed after ${remedyPlans.size} attempts", es = errors, isAlwaysMode = true)
remedyPlans.clear()
} else YukiLog.warn(msg = "RemedyPlan is empty, forgot it?")
} else YLog.warn(msg = "RemedyPlan is empty, forgot it?")
}
/**

View File

@@ -44,7 +44,7 @@ import com.highcapable.yukireflection.finder.type.factory.ObjectConditions
import com.highcapable.yukireflection.finder.type.factory.ObjectsConditions
import com.highcapable.yukireflection.type.defined.UndefinedType
import com.highcapable.yukireflection.type.defined.VagueType
import com.highcapable.yukireflection.utils.debug.YukiLog
import com.highcapable.yukireflection.utils.debug.YLog
import com.highcapable.yukireflection.utils.factory.runBlocking
import java.lang.reflect.Method
@@ -396,7 +396,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
if (isFindSuccess) return
errorMsg(msg = "RemedyPlan failed after ${remedyPlans.size} attempts", es = errors, isAlwaysMode = true)
remedyPlans.clear()
} else YukiLog.warn(msg = "RemedyPlan is empty, forgot it?")
} else YLog.warn(msg = "RemedyPlan is empty, forgot it?")
}
/**

View File

@@ -49,7 +49,7 @@ import com.highcapable.yukireflection.type.java.DalvikBaseDexClassLoader
import com.highcapable.yukireflection.type.java.NoClassDefFoundErrorClass
import com.highcapable.yukireflection.type.java.NoSuchFieldErrorClass
import com.highcapable.yukireflection.type.java.NoSuchMethodErrorClass
import com.highcapable.yukireflection.utils.debug.YukiLog
import com.highcapable.yukireflection.utils.debug.YLog
import com.highcapable.yukireflection.utils.factory.conditions
import com.highcapable.yukireflection.utils.factory.findLastIndex
import com.highcapable.yukireflection.utils.factory.lastIndex
@@ -202,7 +202,7 @@ internal object ReflectionTool {
fun MemberRulesData.exists(vararg type: Any?): Boolean {
if (type.isEmpty()) return true
for (i in type.indices) if (type[i] == UndefinedType) {
YukiLog.warn(msg = "$objectName type[$i] mistake, it will be ignored in current conditions")
YLog.warn(msg = "$objectName type[$i] mistake, it will be ignored in current conditions")
return false
}
return true
@@ -666,7 +666,7 @@ internal object ReflectionTool {
addAll(declaredConstructors.toList())
}.asSequence()
}.onFailure {
YukiLog.warn(msg = "Failed to get the declared Members in [$this] because got an exception", e = it)
YLog.warn(msg = "Failed to get the declared Members in [$this] because got an exception", e = it)
}.getOrNull()
/**
@@ -675,7 +675,7 @@ internal object ReflectionTool {
*/
private val Class<*>.existFields
get() = runCatching { declaredFields.asSequence() }.onFailure {
YukiLog.warn(msg = "Failed to get the declared Fields in [$this] because got an exception", e = it)
YLog.warn(msg = "Failed to get the declared Fields in [$this] because got an exception", e = it)
}.getOrNull()
/**
@@ -684,7 +684,7 @@ internal object ReflectionTool {
*/
private val Class<*>.existMethods
get() = runCatching { declaredMethods.asSequence() }.onFailure {
YukiLog.warn(msg = "Failed to get the declared Methods in [$this] because got an exception", e = it)
YLog.warn(msg = "Failed to get the declared Methods in [$this] because got an exception", e = it)
}.getOrNull()
/**
@@ -693,7 +693,7 @@ internal object ReflectionTool {
*/
private val Class<*>.existConstructors
get() = runCatching { declaredConstructors.asSequence() }.onFailure {
YukiLog.warn(msg = "Failed to get the declared Constructors in [$this] because got an exception", e = it)
YLog.warn(msg = "Failed to get the declared Constructors in [$this] because got an exception", e = it)
}.getOrNull()
/**

View File

@@ -37,7 +37,7 @@ import com.highcapable.yukireflection.utils.factory.dumpToString
/**
* 全局 Log 管理类
*/
internal object YukiLog {
internal object YLog {
/**
* 是否启用