withLoggingContext

inline fun <T> withLoggingContext(pair: Pair<String, String?>, body: () -> T): T

Use a pair in MDC context. Example:

withLoggingContext("userId" to userId) {
doSomething()
}
inline fun <T> withLoggingContext(vararg pair: Pair<String, String?>, body: () -> T): T

Use a vary number of pairs in MDC context. Example:

withLoggingContext("userId" to userId) {
doSomething()
}
inline fun <T> withLoggingContext(map: Map<String, String>, body: () -> T): T

Use a map in MDC context. Example:

withLoggingContext(mapOf("userId" to userId)) {
doSomething()
}