MessageFormatter factory

This commit is contained in:
InsanusMokrassar 2022-07-31 19:19:17 +06:00
parent 194e52f521
commit 77ca9ce25b
2 changed files with 3 additions and 0 deletions

View File

@ -5,6 +5,7 @@
* Add `setDefaultKSLog` and `addDefaultKSLog` * Add `setDefaultKSLog` and `addDefaultKSLog`
* Add `plus` operation for two `KSLog` instances to call them both on each log performing * Add `plus` operation for two `KSLog` instances to call them both on each log performing
* Add `KSLog` factory for simple creation of `CallbackKSLog` * Add `KSLog` factory for simple creation of `CallbackKSLog`
* Add `MessageFormatter` factory
## 0.4.1 ## 0.4.1

View File

@ -1,6 +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")
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 - $m" }