添加日志工具类

This commit is contained in:
tursom 2019-11-30 10:35:04 +08:00
parent 0229dbe0df
commit 87aa8816bd

View File

@ -1,12 +1,13 @@
package cn.tursom.log.impl
import cn.tursom.log.Slf4j
import cn.tursom.log.TrySlf4j
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import kotlin.reflect.KClass
import kotlin.reflect.jvm.jvmName
class Slf4jImpl(name: String? = null) : Slf4j {
class Slf4jImpl(name: String? = null) : Slf4j, TrySlf4j {
constructor(clazz: Class<*>?) : this(clazz?.name)
constructor(clazz: KClass<*>?) : this(clazz?.jvmName?.let {
if (clazz.isCompanion) it.dropLast(10) else it
@ -20,4 +21,7 @@ class Slf4jImpl(name: String? = null) : Slf4j {
} else {
throw NotImplementedError("")
})
override val logger: Logger get() = log
override val sfl4j: Logger get() = log
}