=act #19496 add sender information in LoggingReceive

This commit is contained in:
Konrad Malawski 2016-01-17 20:38:36 +01:00
parent 6f89251810
commit 9209a302c5
2 changed files with 7 additions and 3 deletions

View file

@ -66,7 +66,8 @@ class LoggingReceiveSpec extends WordSpec with BeforeAndAfterAll {
})
}))
a ! "hallo"
expectMsg(1 second, Logging.Debug("funky", classOf[DummyClassForStringSources], "received unhandled message hallo"))
expectMsg(1 second, Logging.Debug("funky", classOf[DummyClassForStringSources],
"received unhandled message hallo from " + system.deadLetters))
expectMsgType[UnhandledMessage](1 second)
}
}
@ -91,7 +92,8 @@ class LoggingReceiveSpec extends WordSpec with BeforeAndAfterAll {
val name = actor.path.toString
actor ! "buh"
within(1 second) {
expectMsg(Logging.Debug(actor.path.toString, actor.underlyingActor.getClass, "received handled message buh"))
expectMsg(Logging.Debug(actor.path.toString, actor.underlyingActor.getClass,
"received handled message buh from " + self))
expectMsg("x")
}
@ -116,7 +118,8 @@ class LoggingReceiveSpec extends WordSpec with BeforeAndAfterAll {
})
actor ! "buh"
within(1 second) {
expectMsg(Logging.Debug(actor.path.toString, actor.underlyingActor.getClass, "received handled message buh"))
expectMsg(Logging.Debug(actor.path.toString, actor.underlyingActor.getClass,
"received handled message buh from " + self))
expectMsg("x")
}
}

View file

@ -54,6 +54,7 @@ class LoggingReceive(source: Option[AnyRef], r: Receive, label: Option[String])(
if (context.system.eventStream.logLevel >= Logging.DebugLevel) {
val (str, clazz) = LogSource.fromAnyRef(source getOrElse context.asInstanceOf[ActorCell].actor)
context.system.eventStream.publish(Debug(str, clazz, "received " + (if (handled) "handled" else "unhandled") + " message " + o
+ " from " + context.sender()
+ (label match {
case Some(l) " in state " + l
case _ ""