Possible Duplicate:
How to overload bang(!) operator in Scala Actor model?
In an Actor model implementation in Scala, can we override the bang(!) operator?
I need to modify the operation of message passing by overloading this operator?
I need to include logging of the message sent when any actor sends a message to any other actor.
I started by
override def !(msg:Any):Unit =
{
//logic for writing to logs..
super.!(msg)
}
This works fine. But, i want to differentiate behavior of !, depending upon the messages I am sending.
actor_name!(arg1,arg2,arg3)
actor_name1!(arg4, arg5)
in the above case, for first ! opertion, i need to perform logging. And for second !, i just want to print on the screen.
How do i differentiate between these two message sending notation in the overriding code?
Maybe like so ?