now tag in MessageFormatter is a nullable

This commit is contained in:
InsanusMokrassar 2022-07-31 19:22:08 +06:00
parent 77ca9ce25b
commit 66c5451293

View File

@ -1,8 +1,8 @@
package dev.inmo.kslog.common package dev.inmo.kslog.common
typealias MessageFormatter = (l: LogLevel, t: String, m: Any, Throwable?) -> String typealias MessageFormatter = (l: LogLevel, t: String?, m: Any, Throwable?) -> String
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun MessageFormatter(noinline formatter: MessageFormatter) = formatter inline fun MessageFormatter(noinline formatter: MessageFormatter) = formatter
typealias MessageFilter = (l: LogLevel, t: String?, Throwable?) -> Boolean typealias MessageFilter = (l: LogLevel, t: String?, Throwable?) -> Boolean
val defaultMessageFormatter: MessageFormatter = { l, t, m, _ -> "[$l] $t - $m" } val defaultMessageFormatter: MessageFormatter = { l, t, m, _ -> "[$l] ${t ?.let { "$it " } ?: ""}- $m" }