A Scala 'debug' Macro

If you are one of those guys who do not use a debugger and felt that the more efficient way to navigate a complex codebase is still through “careful thought, coupled with judiciously placed print statements”, then here is a nifty macro that I wrote to make it hopefully slightly easier in Scala.

Following is some of the features it provides:

debug4s original image

After I posted it on r/Scala, I got some really nice feedback from Ólafur Páll Geirsson, who implemented a similiar function using sourcecode and pprint in the response, which is pretty cool. The only difference is that it doesn’t support multiple parameters, but it can be worked around by using several debug statement.

If you find it useful, take a look at README.md to find out more.

Written on June 2, 2019