Getting Started

To handle log entries created with any logging API using timber, you need to use the timber backend.

A More Complex Example

Most dispatcher configurations won’t be as simple as the examples above. Here’s an example of a more realistic (and more complex) configuration just to give you a taste. For more detail, you should read the section on the timber DSL.

import org.scalawag.timber.api.Level._
import org.scalawag.timber.backend.dispatcher.configuration.Configuration
import org.scalawag.timber.backend.dispatcher.configuration.dsl._

val config = Configuration {
  fanout (
    ( level >= WARN ),
    ( loggingClass startsWith "com.example" ) ~> ( level >= DEBUG )
  ) ~> file("application.log")
}

This will send any entries that have a level of WARN or higher or were logged from a class in the com.example package and have a level of DEBUG or higher to the file application.log. Any other entries will be dropped.

Next steps

Help improve this page.