cats-effect
cats-effect copied to clipboard
Add thread name to IO.debug
It'd be very useful to have the thread name in the IO.debug extension method, which is implemented as follows in v3.7-4972921. Something like IO.println(s"[${Thread.currentThread().getName}] ${prefix}: Succeeded: ${S.show(a)}").
def debug[B >: A](prefix: String = "DEBUG")(
implicit S: Show[B] = Show.fromToString[B]): IO[A] =
guaranteeCase {
case Outcome.Succeeded(ioa) =>
ioa.flatMap(a => IO.println(s"${prefix}: Succeeded: ${S.show(a)}"))
case Outcome.Errored(ex) =>
IO.println(s"${prefix}: Errored: ${ex}")
case Outcome.Canceled() =>
IO.println(s"${prefix}: Canceled")
}
Hi, I would like to work on this issue. Can you please assign it to me?
Did you take a look at #4525? What's your opinion on the question I've asked there?