LogMessages get fed to loggers, allowing custom control of the message String.
Typeclass for producing structured logs
Defines a simple logging facility.
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:
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._
LogMessages get fed to loggers, allowing custom control of the message String.
Normally, you just supply whatever Show instance for your data you want to control the log output, but custom sub-types may implement structured log formats such as JSON.