diff --git a/src/commonMain/kotlin/KSLog.kt b/src/commonMain/kotlin/KSLog.kt index b26a98f..51aca1f 100644 --- a/src/commonMain/kotlin/KSLog.kt +++ b/src/commonMain/kotlin/KSLog.kt @@ -2,12 +2,12 @@ package dev.inmo.kslog.common enum class LogLevel { + DEBUG, VERBOSE, INFO, WARNING, ERROR, ASSERT, - DEBUG } interface KSLog { @@ -65,7 +65,7 @@ fun KSLog( fun KSLog( defaultTag: String, - minLoggingLevel: LogLevel = LogLevel.VERBOSE + minLoggingLevel: LogLevel = LogLevel.values().first() ): KSLog = KSLog (defaultTag) { l, _, _, _ -> minLoggingLevel.ordinal <= l.ordinal } diff --git a/src/jsMain/kotlin/ActualLogger.kt b/src/jsMain/kotlin/ActualLogger.kt index 21b0c4e..1390ee4 100644 --- a/src/jsMain/kotlin/ActualLogger.kt +++ b/src/jsMain/kotlin/ActualLogger.kt @@ -11,12 +11,12 @@ fun KSJSLog( arrayOf(text, e) } ?: arrayOf(text) when (l) { + LogLevel.DEBUG -> console.log(*args) LogLevel.VERBOSE, LogLevel.INFO -> console.info(*args) LogLevel.WARNING -> console.warn(*args) LogLevel.ERROR, LogLevel.ASSERT -> console.error(*args) - LogLevel.DEBUG -> console.log(*args) } } @@ -42,7 +42,7 @@ fun KSJSLog( fun KSJSLog( defaultTag: String, messageFormatter: MessageFormatter = defaultMessageFormatter, - minLoggingLevel: LogLevel = LogLevel.VERBOSE + minLoggingLevel: LogLevel = LogLevel.values().first() ): KSLog = KSJSLog (defaultTag, messageFormatter) { l, _, _, _ -> minLoggingLevel.ordinal <= l.ordinal } diff --git a/src/jvmMain/kotlin/ActualLogger.kt b/src/jvmMain/kotlin/ActualLogger.kt index 0f0b271..8f3326b 100644 --- a/src/jvmMain/kotlin/ActualLogger.kt +++ b/src/jvmMain/kotlin/ActualLogger.kt @@ -49,7 +49,7 @@ fun KSJVMLog( defaultTag: String, logger: java.util.logging.Logger, messageFormatter: MessageFormatter = defaultMessageFormatter, - minLoggingLevel: LogLevel = LogLevel.VERBOSE + minLoggingLevel: LogLevel = LogLevel.values().first() ): KSLog = KSJVMLog (defaultTag, logger, messageFormatter) { l, _, _, _ -> minLoggingLevel.ordinal <= l.ordinal } diff --git a/src/main/kotlin/ActualLogger.kt b/src/main/kotlin/ActualLogger.kt index 681b04b..06deb6c 100644 --- a/src/main/kotlin/ActualLogger.kt +++ b/src/main/kotlin/ActualLogger.kt @@ -9,12 +9,12 @@ fun KSAndroidLog( if (!filter(l, t ?: defaultTag, m, e)) return@KSLog val tag = t ?: defaultTag when(l) { + LogLevel.DEBUG -> Log.d(tag, m, e) LogLevel.VERBOSE -> Log.v(tag, m, e) LogLevel.INFO -> Log.i(tag, m, e) LogLevel.WARNING -> Log.w(tag, m, e) LogLevel.ERROR -> Log.e(tag, m, e) LogLevel.ASSERT -> Log.wtf(tag, m, e) - LogLevel.DEBUG -> Log.d(tag, m, e) } }