What is a good way to do logging in a Scala application? Something that is consistent with the language philosophy, does not clutter the code, and is low-maintenance and uno
I use SLF4J + Logback classic and apply it like this:
trait Logging {
lazy val logger = LoggerFactory.getLogger(getClass)
implicit def logging2Logger(anything: Logging): Logger = anything.logger
}
Then you can use it whichever fits your style better:
class X with Logging {
logger.debug("foo")
debug("bar")
}
but this approach of course uses a logger instance per class instance.