mirror of
https://github.com/InsanusMokrassar/KSLog.git
synced 2024-12-22 22:17:15 +00:00
fix of #3
This commit is contained in:
parent
5f49b183e0
commit
82085783c0
@ -2,7 +2,5 @@ package dev.inmo.kslog.common
|
|||||||
|
|
||||||
val Any.logTag
|
val Any.logTag
|
||||||
get() = this::class.simpleName ?: error("Unable to retrieve log tag")
|
get() = this::class.simpleName ?: error("Unable to retrieve log tag")
|
||||||
val Any.logger
|
val Any.logger: KSLog
|
||||||
get() = CallbackKSLog { l, t, m, e ->
|
get() = TagLogger(logTag)
|
||||||
KSLog.default.performLog(l, t ?: logTag, m, e)
|
|
||||||
}
|
|
||||||
|
10
src/commonMain/kotlin/TagLogger.kt
Normal file
10
src/commonMain/kotlin/TagLogger.kt
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user