|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LogSource<T>
This trait defines the interface to be provided by a “log source formatting
rule” as used by Logging
’s apply
/create
method.
See the companion object for default implementations.
Example:
trait MyType { // as an example
def name: String
}
implicit val myLogSourceType: LogSource[MyType] = new LogSource {
def genString(a: MyType) = a.name
}
class MyClass extends MyType {
val log = Logging(eventStream, this) // will use "hallo" as logSource
def name = "hallo"
}
The second variant is used for including the actor system’s address:
trait MyType { // as an example
def name: String
}
implicit val myLogSourceType: LogSource[MyType] = new LogSource {
def genString(a: MyType) = a.name
def genString(a: MyType, s: ActorSystem) = a.name + "," + s
}
class MyClass extends MyType {
val sys = ActorSyste("sys")
val log = Logging(sys, this) // will use "hallo,akka://sys" as logSource
def name = "hallo"
}
The default implementation of the second variant will just call the first.
Method Summary | ||
---|---|---|
|
apply(T o,
ActorSystem system,
LogSource<T> evidence$2)
Convenience converter access: given an implicit LogSource and
ActorSystem , generate the string representation and
originating class. |
|
|
apply(T o,
LogSource<T> evidence$1)
Convenience converter access: given an implicit LogSource , generate the
string representation and originating class. |
|
LogSource<Actor> |
fromActor()
|
|
LogSource<ActorRef> |
fromActorRef()
|
|
|
fromAnyClass()
|
|
scala.Tuple2<java.lang.String,java.lang.Class<?>> |
fromAnyRef(java.lang.Object o)
construct string representation for any object according to rules above with fallback to its Class ’s simple name. |
|
scala.Tuple2<java.lang.String,java.lang.Class<?>> |
fromAnyRef(java.lang.Object o,
ActorSystem system)
construct string representation for any object according to rules above (including the actor system’s address) with fallback to its Class ’s simple name. |
|
LogSource<java.lang.Class<?>> |
fromClass()
|
|
LogSource<java.lang.String> |
fromString()
|
|
java.lang.String |
genString(T t)
|
|
java.lang.String |
genString(T t,
ActorSystem system)
|
|
java.lang.Class<?> |
getClazz(T t)
|
Method Detail |
---|
LogSource<java.lang.String> fromString()
LogSource<Actor> fromActor()
LogSource<ActorRef> fromActorRef()
LogSource<java.lang.Class<?>> fromClass()
<T> LogSource<java.lang.Class<T>> fromAnyClass()
<T> scala.Tuple2<java.lang.String,java.lang.Class<?>> apply(T o, LogSource<T> evidence$1)
LogSource
, generate the
string representation and originating class.
<T> scala.Tuple2<java.lang.String,java.lang.Class<?>> apply(T o, ActorSystem system, LogSource<T> evidence$2)
LogSource
and
ActorSystem
, generate the string representation and
originating class.
scala.Tuple2<java.lang.String,java.lang.Class<?>> fromAnyRef(java.lang.Object o)
Class
’s simple name.
scala.Tuple2<java.lang.String,java.lang.Class<?>> fromAnyRef(java.lang.Object o, ActorSystem system)
Class
’s simple name.
java.lang.String genString(T t)
java.lang.String genString(T t, ActorSystem system)
java.lang.Class<?> getClazz(T t)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |