mirror of
https://github.com/InsanusMokrassar/KSLog.git
synced 2024-12-22 14:07: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
|
||||
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)
|
||||
|
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