-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suspending function in curly brackets #338
Comments
Thank you for reporting an issue. See the wiki for documentation and slack for questions. |
I wouldn't use
(There is another question here which is why a log message computation will be a suspended operation). |
Thanks, I overlooked this detail.
Mutexes, mutexes everywhere. |
@oshai so, for example, now you should do something like that if(logger.isDebugEnabled()) { // or even trace
val extraContext = loadMoreContext() // suspend func call
logger.debug("Oops! Here is more context $extraContext")
} instead of something like that logger.coDebug { "Oops! Here is more context ${loadMoreContext()}" } |
I have a following code with version 4.0.1
Now that version 5.0.0 deprecates round brackets, a straight conversion doesn't work, because it loses the suspension.
Would be a recommended way to wrap the suspending call into
runBlocking
like this?logger.info { "Foo ${runBlocking { bar() }}" }
The text was updated successfully, but these errors were encountered: