KSLog/src/commonMain/kotlin/utils/Combination.kt

16 lines
444 B
Kotlin
Raw Normal View History

2022-07-31 13:06:57 +00:00
package dev.inmo.kslog.common.utils
import dev.inmo.kslog.common.CallbackKSLog
import dev.inmo.kslog.common.KSLog
infix operator fun KSLog.plus(other: KSLog) = CallbackKSLog { l, t, m, e ->
val resultOfFirst = runCatching {
this@plus.performLog(l, t, m, e)
}
val resultOfSecond = runCatching {
other.performLog(l, t, m, e)
}
resultOfFirst.onFailure { throw it }
resultOfSecond.onFailure { throw it }
2022-07-31 13:06:57 +00:00
}