Scala Cats: How to test logging vs how to log in production code

374 views Asked by At

Could you give me a tagless-final version in Scala, of a logging implementation that is easily testable in unit tests but runs with slf4j or similar frameworks in production?

1

There are 1 answers

0
Hunor Kovács On

Here's a skeleton I worked out for myself.

Tests are written with cats' Writer monad.

Todo: write it for something else than Id. What if you need to test errors meanwhile.