From c48ceefd8a2423a0f0f23adfb9f8bebe5a65a5ab Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 7 Jun 2022 22:00:32 +0600 Subject: [PATCH] add new KSLog factory --- src/commonMain/kotlin/KSLog.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/commonMain/kotlin/KSLog.kt b/src/commonMain/kotlin/KSLog.kt index a8c0487..495b152 100644 --- a/src/commonMain/kotlin/KSLog.kt +++ b/src/commonMain/kotlin/KSLog.kt @@ -44,7 +44,14 @@ expect fun KSLog( fun KSLog( defaultTag: String, - levels: Set = LogLevel.values().toSet() + levels: Set ): KSLog = KSLog (defaultTag) { l, _, _, _ -> l in levels } + +fun KSLog( + defaultTag: String, + minLoggingLevel: LogLevel = LogLevel.VERBOSE +): KSLog = KSLog (defaultTag) { l, _, _, _ -> + minLoggingLevel.ordinal <= l.ordinal +}