mirror of
https://github.com/InsanusMokrassar/KSLog.git
synced 2024-12-22 22:17:15 +00:00
commit
f5cc748ac5
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
* Changes in `JVM` levels
|
||||||
|
* Fixes in TagLogger
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
|
|
||||||
* All the platform specific logged factories has been renamed
|
* All the platform specific logged factories has been renamed
|
||||||
|
@ -9,5 +9,5 @@ android.enableJetifier=true
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.1.0
|
version=0.1.1
|
||||||
android_code_version=4
|
android_code_version=5
|
||||||
|
@ -2,12 +2,12 @@ package dev.inmo.kslog.common
|
|||||||
|
|
||||||
|
|
||||||
enum class LogLevel {
|
enum class LogLevel {
|
||||||
|
DEBUG,
|
||||||
VERBOSE,
|
VERBOSE,
|
||||||
INFO,
|
INFO,
|
||||||
WARNING,
|
WARNING,
|
||||||
ERROR,
|
ERROR,
|
||||||
ASSERT,
|
ASSERT,
|
||||||
DEBUG
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface KSLog {
|
interface KSLog {
|
||||||
@ -65,7 +65,7 @@ fun KSLog(
|
|||||||
|
|
||||||
fun KSLog(
|
fun KSLog(
|
||||||
defaultTag: String,
|
defaultTag: String,
|
||||||
minLoggingLevel: LogLevel = LogLevel.VERBOSE
|
minLoggingLevel: LogLevel = LogLevel.values().first()
|
||||||
): KSLog = KSLog (defaultTag) { l, _, _, _ ->
|
): KSLog = KSLog (defaultTag) { l, _, _, _ ->
|
||||||
minLoggingLevel.ordinal <= l.ordinal
|
minLoggingLevel.ordinal <= l.ordinal
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,6 @@ import kotlin.jvm.JvmInline
|
|||||||
@JvmInline
|
@JvmInline
|
||||||
value class TagLogger(val tag: String) : KSLog {
|
value class TagLogger(val tag: String) : KSLog {
|
||||||
override fun performLog(level: LogLevel, tag: String?, message: String, throwable: Throwable?) {
|
override fun performLog(level: LogLevel, tag: String?, message: String, throwable: Throwable?) {
|
||||||
KSLog.performLog(level, tag ?: tag, message, throwable)
|
KSLog.performLog(level, tag ?: this.tag, message, throwable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,12 @@ fun KSJSLog(
|
|||||||
arrayOf(text, e)
|
arrayOf(text, e)
|
||||||
} ?: arrayOf(text)
|
} ?: arrayOf(text)
|
||||||
when (l) {
|
when (l) {
|
||||||
|
LogLevel.DEBUG -> console.log(*args)
|
||||||
LogLevel.VERBOSE,
|
LogLevel.VERBOSE,
|
||||||
LogLevel.INFO -> console.info(*args)
|
LogLevel.INFO -> console.info(*args)
|
||||||
LogLevel.WARNING -> console.warn(*args)
|
LogLevel.WARNING -> console.warn(*args)
|
||||||
LogLevel.ERROR,
|
LogLevel.ERROR,
|
||||||
LogLevel.ASSERT -> console.error(*args)
|
LogLevel.ASSERT -> console.error(*args)
|
||||||
LogLevel.DEBUG -> console.log(*args)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ fun KSJSLog(
|
|||||||
fun KSJSLog(
|
fun KSJSLog(
|
||||||
defaultTag: String,
|
defaultTag: String,
|
||||||
messageFormatter: MessageFormatter = defaultMessageFormatter,
|
messageFormatter: MessageFormatter = defaultMessageFormatter,
|
||||||
minLoggingLevel: LogLevel = LogLevel.VERBOSE
|
minLoggingLevel: LogLevel = LogLevel.values().first()
|
||||||
): KSLog = KSJSLog (defaultTag, messageFormatter) { l, _, _, _ ->
|
): KSLog = KSJSLog (defaultTag, messageFormatter) { l, _, _, _ ->
|
||||||
minLoggingLevel.ordinal <= l.ordinal
|
minLoggingLevel.ordinal <= l.ordinal
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,12 @@ fun KSJVMLog(
|
|||||||
val text = messageFormatter(l,t ?: defaultTag,m,e)
|
val text = messageFormatter(l,t ?: defaultTag,m,e)
|
||||||
logger.log(
|
logger.log(
|
||||||
when(l) {
|
when(l) {
|
||||||
LogLevel.VERBOSE -> Level.FINEST
|
LogLevel.DEBUG -> Level.FINEST
|
||||||
|
LogLevel.VERBOSE -> Level.FINE
|
||||||
LogLevel.INFO -> Level.INFO
|
LogLevel.INFO -> Level.INFO
|
||||||
LogLevel.WARNING -> Level.WARNING
|
LogLevel.WARNING -> Level.WARNING
|
||||||
LogLevel.ERROR -> Level.SEVERE
|
LogLevel.ERROR -> Level.SEVERE
|
||||||
LogLevel.ASSERT -> Level.OFF
|
LogLevel.ASSERT -> Level.SEVERE
|
||||||
LogLevel.DEBUG -> Level.ALL
|
|
||||||
},
|
},
|
||||||
text,
|
text,
|
||||||
e
|
e
|
||||||
@ -49,7 +49,7 @@ fun KSJVMLog(
|
|||||||
defaultTag: String,
|
defaultTag: String,
|
||||||
logger: java.util.logging.Logger,
|
logger: java.util.logging.Logger,
|
||||||
messageFormatter: MessageFormatter = defaultMessageFormatter,
|
messageFormatter: MessageFormatter = defaultMessageFormatter,
|
||||||
minLoggingLevel: LogLevel = LogLevel.VERBOSE
|
minLoggingLevel: LogLevel = LogLevel.values().first()
|
||||||
): KSLog = KSJVMLog (defaultTag, logger, messageFormatter) { l, _, _, _ ->
|
): KSLog = KSJVMLog (defaultTag, logger, messageFormatter) { l, _, _, _ ->
|
||||||
minLoggingLevel.ordinal <= l.ordinal
|
minLoggingLevel.ordinal <= l.ordinal
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,12 @@ fun KSAndroidLog(
|
|||||||
if (!filter(l, t ?: defaultTag, m, e)) return@KSLog
|
if (!filter(l, t ?: defaultTag, m, e)) return@KSLog
|
||||||
val tag = t ?: defaultTag
|
val tag = t ?: defaultTag
|
||||||
when(l) {
|
when(l) {
|
||||||
|
LogLevel.DEBUG -> Log.d(tag, m, e)
|
||||||
LogLevel.VERBOSE -> Log.v(tag, m, e)
|
LogLevel.VERBOSE -> Log.v(tag, m, e)
|
||||||
LogLevel.INFO -> Log.i(tag, m, e)
|
LogLevel.INFO -> Log.i(tag, m, e)
|
||||||
LogLevel.WARNING -> Log.w(tag, m, e)
|
LogLevel.WARNING -> Log.w(tag, m, e)
|
||||||
LogLevel.ERROR -> Log.e(tag, m, e)
|
LogLevel.ERROR -> Log.e(tag, m, e)
|
||||||
LogLevel.ASSERT -> Log.wtf(tag, m, e)
|
LogLevel.ASSERT -> Log.wtf(tag, m, e)
|
||||||
LogLevel.DEBUG -> Log.d(tag, m, e)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user