To use simply mix in the Logging trait.
The standard Show type-class instances can
be imported by importing the Logging object:
For example:
class MyClass extends Actor with Logging {
import Logging._
info("MyClass is instantiated!")
¬タᆭ
}
Note you will need an instance of the LogWriter
typeclass in implicit scope for any type you
want to log. The most convenient way to contruct a
LogWriter is deriving it from a Show instance,
but a LogWriter can be derived for more structured
data, allowing for structured logging formats such as
JSON.
Most commonly you may want Show[String],
for which you can import scalaz.std.string._
Defines a simple logging facility.
To use simply mix in the Logging trait. The standard Show type-class instances can be imported by importing the Logging object:
For example:
Note you will need an instance of the LogWriter typeclass in implicit scope for any type you want to log. The most convenient way to contruct a LogWriter is deriving it from a Show instance, but a LogWriter can be derived for more structured data, allowing for structured logging formats such as JSON.
Most commonly you may want Show[String], for which you can
import scalaz.std.string._