Skip to content

Commit

Permalink
=act akka#19496 add sender information in LoggingReceive
Browse files Browse the repository at this point in the history
  • Loading branch information
ktoso committed Jan 17, 2016
1 parent 6f89251 commit 9209a30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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")
}

Expand All @@ -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")
}
}
Expand Down
1 change: 1 addition & 0 deletions akka-actor/src/main/scala/akka/event/LoggingReceive.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 _ ""
Expand Down

0 comments on commit 9209a30

Please sign in to comment.