Frequently the purpose of logging is to provide information about what is happening in the system,
which requires including information about the objects being manipulated. In Scala, you can use
string interpolation
to achieve this:
logger.debug(s"Logging in user ${user.getName} with birthday ${user.calcBirthday}")
Since this wrapper is implemented with macros, the String construction and method invocations
will only occur when debug logging is enabled.
Scala wrapper for the Log4j
Logger
interface.Frequently the purpose of logging is to provide information about what is happening in the system, which requires including information about the objects being manipulated. In Scala, you can use string interpolation to achieve this:
logger.debug(s"Logging in user ${user.getName} with birthday ${user.calcBirthday}")
Since this wrapper is implemented with macros, the String construction and method invocations will only occur when debug logging is enabled.