This trait defines the interface to be provided by a “log source formatting
rule” as used by akka.event.Logging’s apply/create method.
See the companion object for default implementations.
Example:
trait MyType { // as an exampledef name: String
}
implicitval myLogSourceType: LogSource[MyType] = new LogSource[MyType] {
def genString(a: MyType) = a.name
}
class MyClass extends MyType {
val log = Logging(eventStream, this) // will use "hallo" as logSourcedef name = "hallo"
}
The second variant is used for including the actor system’s address:
trait MyType { // as an exampledef name: String
}
implicitval myLogSourceType: LogSource[MyType] = new LogSource[MyType] {
def genString(a: MyType) = a.name
def genString(a: MyType, s: ActorSystem) = a.name + "," + s
}
class MyClass extends MyType {
val sys = ActorSystem("sys")
val log = Logging(sys, this) // will use "hallo,akka://sys" as logSourcedef name = "hallo"
}
The default implementation of the second variant will just call the first.
This trait defines the interface to be provided by a “log source formatting rule” as used by akka.event.Logging’s
apply
/create
method.See the companion object for default implementations.
Example:
The second variant is used for including the actor system’s address:
The default implementation of the second variant will just call the first.