See docs
Avaialble for scala versions 2.11, and 2.12. SBT artifacts:
"iolog4s.org" %% "iolog4s" % "0.0.1"
iolog4s is a logging library for scala that suspends all your logging side-effects into your chosen cats.effect.Sync instance, e.g.:
iolog4s has the same interface as log4s, except all return types are of type F[Unit] where F[_]: Sync.
The vast majority of the development effort goes to the authors of log4s, as the code here is mostly altered versions of their macros. So please extend all your thanks to them! It also means that you can expect the same reliability.
object Main extends App {
import org.iolog4s._
import cats.effect.IO
val logger: Logger[IO] = Logger.create[IO]
val logs: IO[Unit] = for {
_ <- logger.trace("test-trace")
_ <- logger.debug("test-debug")
_ <- logger.info("test-info")
_ <- logger.warn("test-warn")
_ <- logger.error("test-error")
} yield ()
logs.unsafeRunSync()
}
Support for MDC is still under development, stay tuned.