typelevel / typelevel/cats-effect
Add thread name to IO.debug
Open
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.2k
- Forks
- 576
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
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")
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the IO.debug extension method shown in the issue and inspect how its success, error, and cancellation messages are assembled. Add the current thread name to the debug output in the requested format, then find or run the relevant existing tests to verify all three outcomes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100