When using coroutine router, it has a final coroutineScope inside, which is created lazily from worker.
However, there seems to be no easy way to add a CoroutineContext to the scope, e.g. MDCContext from
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-slf4j/index.html
Could there be a setter for coroutineScope, to enable code like this:
coroutine {
coroutineScope += MDCContext()
// routes here
}
or another option is to add scope to CouroutineRouter constructor:
coroutine(context = MDCContext()) {
// routes here
}
When using coroutine router, it has a final coroutineScope inside, which is created lazily from worker.
However, there seems to be no easy way to add a CoroutineContext to the scope, e.g. MDCContext from
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-slf4j/index.html
Could there be a setter for coroutineScope, to enable code like this:
coroutine { coroutineScope += MDCContext() // routes here }or another option is to add scope to CouroutineRouter constructor: