The scala-logging is a convenient logging library warpping
slf4j logging API.
1 Getting Started
To use scala-logging, import it and one of Sl4j implementations such as logback.
2 Creating a Logger
There are two ways to create a logger instance: one using the factory as the following
3 Mixing Trait
The other way is to mix one of the two traits:
StrictLogging. The difference is that the
LazyLogging create a lzay
protected lazy val logger: Logger = Logger(LoggerFactory.getLogger(getClass.getName)).
The log methods such as
warn etc are implemented using Scala
macro. The macro implement actually performs one task: it checks the log level before message logging.