When studying sources of akka
I found the following in the akka.event.slf4j.SLF4JLogger
actor:
def receive = {
//...
case event @ Warning(logSource, logClass, message) ⇒
withMdc(logSource, event) { Logger(logClass, logSource).warn("{}", message.asInstanceOf[AnyRef]) }
case event @ Info(logSource, logClass, message) ⇒
withMdc(logSource, event) { Logger(logClass, logSource).info("{}", message.asInstanceOf[AnyRef]) }
case event @ Debug(logSource, logClass, message) ⇒
withMdc(logSource, event) { Logger(logClass, logSource).debug("{}", message.asInstanceOf[AnyRef]) }
//...
}
I didn't quite understand what is the @
sign. It was not a method and there's no declaration of the event
in scope. Warning
, Info
and Debug
are all objects with apply methods.