Use slf4j logger from the incoming instance.getClass.getName. Fixes #1121

* Different logger based on incoming event.
* Removed format, since that should be in logback configuration.
* The stackTrace is now logged with the error(msg, throwable) method.
This commit is contained in:
Patrik Nordwall 2011-08-29 14:41:46 +02:00
parent 5e290ec393
commit 7da2341bed

View file

@ -35,22 +35,14 @@ class Slf4jEventHandler extends Actor with Logging {
import EventHandler._
def receive = {
case event @ Error(cause, instance, message)
log.error("[{}] [{}] [{}] [{}]",
Array[AnyRef](event.thread.getName, instance.getClass.getName, message.asInstanceOf[AnyRef], stackTraceFor(cause)))
case event @ Warning(instance, message)
log.warn("[{}] [{}] [{}]",
Array[AnyRef](event.thread.getName, instance.getClass.getName, message.asInstanceOf[AnyRef]))
case event @ Info(instance, message)
log.info("[{}] [{}] [{}]",
Array[AnyRef](event.thread.getName, instance.getClass.getName, message.asInstanceOf[AnyRef]))
case event @ Debug(instance, message)
log.debug("[{}] [{}] [{}]",
Array[AnyRef](event.thread.getName, instance.getClass.getName, message.asInstanceOf[AnyRef]))
case Error(cause, instance, message)
Logger(instance.getClass.getName).error(String.valueOf(message), cause)
case Warning(instance, message)
Logger(instance.getClass.getName).warn(String.valueOf(message))
case Info(instance, message)
Logger(instance.getClass.getName).info(String.valueOf(message))
case Debug(instance, message)
Logger(instance.getClass.getName).debug(String.valueOf(message))
case event log.debug("[{}]", event.toString)
}
}