Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package scalawag
    Definition Classes
    org
  • package timber
    Definition Classes
    scalawag
  • package backend
    Definition Classes
    timber
  • package receiver

    Contains all of the built-in support for receivers, which are the leaves of dispatcher routing graphs.

    Contains all of the built-in support for receivers, which are the leaves of dispatcher routing graphs. Receivers do something with entries. Exactly what they do depends on the implementation.

    Definition Classes
    backend
  • package formatter

    Contains functionality for turning log entries into text.

    Contains functionality for turning log entries into text.

    Definition Classes
    receiver
  • package level

    Contains functionality for turning log Levels into text.

    Contains functionality for turning log Levels into text.

    Definition Classes
    formatter
  • package timestamp

    Contains functionality for turning Entry timestamps (which are Longs representing the number of milliseconds since the Unix epoch) into text.

    Contains functionality for turning Entry timestamps (which are Longs representing the number of milliseconds since the Unix epoch) into text.

    Definition Classes
    formatter
  • DefaultEntryFormatter
  • EntryFormatter
  • Formatter
  • MessageOnlyEntryFormatter
  • ProgrammableEntryFormatter

class ProgrammableEntryFormatter extends EntryFormatter

Formats entries using the specified metadata providers to create a header. The metadata providers can be specified using the mini-DSL on the entry object:

  • threadName - the name of the thread that created the entry
  • timestamp - the timestamp at which the entry was created
  • level - the level at which the entry was created (if available)
  • loggingClass - the class from which the log method was called (if available)
  • loggingMethod - the method from which the log method was called (if available)
  • sourceLocation - the location in source (file name and line number) from which the log method was called (if available)
  • tags - the tags associated with the entry
  • loggerAttributes - the logger attributes associated with the entry
  • threadAttributes - the thread attributes associated with the entry
  • loggerAttribute(name) - the logger attribute with the specified name associated with the entry (if available)
  • threadAttribute(name) - the thread attribute with the specified name associated with the entry (if available)
new ProgrammableEntryFormatter(Seq(entry.threadName,entry.loggingClass))

You can also specify Strings to be included literally.

new ProgrammableEntryFormatter(Seq("literal",entry.loggingClass))

In addition to the providers above, you can specify some modifiers to tweak them before their inclusion:

  • formattedWith - allows you to choose how the metadata is formatted, must match the type of the metadata
  • map - allows you to apply an arbitrary mapping function to the metadata before inclusion
  • without - allows you to remove keys from a map before inclusion (e.g., if you already included on of the keys specifically)

If you don't specify a formatter, the toString method of the object will be used. There are some built-in formatters for timestamps and levels that you can use. There are also some built-in formatters for any Iterables that may be more appealing than the default toString implementation.

  • Commas - formats Iterables as strings with commas separating the items
  • Spaces - formats Iterables as strings with spaces separating the items
  • Delimiter(str) - formats Iterables as strings with the specified delimiter separating the items
  • CommasAndEquals - formats Maps as equals-separated pairs separated by commas (e.g., k1=v1,k2=v2)
entry.timestamp formattedWith HumanReadableTimestampFormatter
entry.timestamp formattedWith SimpleDateFormatTimestampFormatter("yyyy/MM/dd")
entry.threadName map { name => name.length }
entry.loggerAttributes without "name" formattedWith CommasAndEquals

For the metadata that may not be present (indicated with "if available" above), you can specify a fallback to use when it's absent with orElse. You can't use orElse after a metadata provider that will definitely return something.

entry.loggingClass orElse entry.loggerAttribute("name") orElse "unknown"

With certain combinations of modifiers, you may have to include parentheses if the scala compiler can't figure out the operator precedence. You can also specify the modifiers without utilizing the infix call style, if you prefer.

Linear Supertypes
EntryFormatter, Formatter[Entry], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ProgrammableEntryFormatter
  2. EntryFormatter
  3. Formatter
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ProgrammableEntryFormatter(metadataProviders: Seq[MetadataProvider], delimiter: String = "|", continuationHeader: ProgrammableEntryFormatter.ContinuationHeader.Value = ProgrammableEntryFormatter.ContinuationHeader.NONE, firstLinePrefix: String = "+", continuationPrefix: String = " ", missingValueString: String = "")

    metadataProviders

    a list of metadata providers to be used to create headers to be included with the message

    delimiter

    the string that separates metadata headers from each other and from the message lines

    continuationHeader

    determines what header is included on lines after the first

    firstLinePrefix

    determines the prefix for the first line of output for an entry

    continuationPrefix

    determines the prefix for the remaining lines of an entry

    missingValueString

    determines the string to use for optional metadata providers that return no content

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. val continuationHeader: ProgrammableEntryFormatter.ContinuationHeader.Value
  7. val continuationPrefix: String
  8. val delimiter: String
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  12. val firstLinePrefix: String
  13. def format(entry: Entry): String
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. val metadataProviders: Seq[MetadataProvider]
  18. val missingValueString: String
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from EntryFormatter

Inherited from Formatter[Entry]

Inherited from AnyRef

Inherited from Any

Ungrouped