Is there a way to make an (inline) function do som...
# coroutines
d
Is there a way to make an (inline) function do something iff it is called from a suspend function? Or to, like, overload a function to have a from-suspend and not-from-suspend version? What I'm trying to do is basically have a function we can call for slf4j MDC like
Copy code
withLoggingField("key", "value") {
  // maybe do other stuff, maybe this next line is actually in some other function called by this block
  <http://log.info|log.info>(...)
}
which, if we're not in a suspend function just does an MDC.put and resets it, but if we are in a suspend function uses kotlinx.coroutines.slf4j.MDCContext to make the MDC context thread-local work