This commit is contained in:
InsanusMokrassar 2022-06-08 12:59:41 +06:00
parent 5f49b183e0
commit 82085783c0
2 changed files with 12 additions and 4 deletions

View File

@ -2,7 +2,5 @@ package dev.inmo.kslog.common
val Any.logTag
get() = this::class.simpleName ?: error("Unable to retrieve log tag")
val Any.logger
get() = CallbackKSLog { l, t, m, e ->
KSLog.default.performLog(l, t ?: logTag, m, e)
}
val Any.logger: KSLog
get() = TagLogger(logTag)

View File

@ -0,0 +1,10 @@
package dev.inmo.kslog.common
import kotlin.jvm.JvmInline
@JvmInline
value class TagLogger(val tag: String) : KSLog {
override fun performLog(level: LogLevel, tag: String?, message: String, throwable: Throwable?) {
KSLog.performLog(level, tag ?: tag, message, throwable)
}
}