How can I print out the coroutine context in which...
# coroutines
l
How can I print out the coroutine context in which a flow operator is running?
s
println(currentCoroutineContext())
?
l
awesome! Thank you!
Follow up question - How did you know about this? Is it something you discovered by yourself (if so, how?) or did you simply read it somewhere in the docs?
s
I tend to read source code and docs a lot while I’m working, especially for interesting stuff like coroutines. I know I’ve used
currentCoroutineContext()
at least once before in real code when writing a caching library. Couldn’t tell you exactly where or when I first learned of its existence, though.