Using Ronald's answer, I wrote this to have an easier way to define my probes:
object LoggingTestProbe { def apply()(implicit system: ActorSystem) : TestProbe = { val probe = TestProbe() probe.setAutoPilot(new TestActor.AutoPilot { def run(sender: ActorRef, msg: Any) = { val other = sender.path val me = probe.ref.path system.log.debug(s"$me received $msg from $other") this } }) probe } }
After that, I define my probes using LoggingTestProbe() instead of TestProbe() .
I am new to Scala, so this may not be optimal, but works fine for me.
marcob
source share