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 buffering

    Contains the composable Receiver buffering policies available in timber.

    Contains the composable Receiver buffering policies available in timber. These only affect how often the receiver is flushed by timber. Many receivers will be based on instances of other classes that are themselves buffered (e.g., BufferedWriters and BufferedOutputStreams). While the flushes that timber instigates should make it down to the underlying objects, those objects may also flush for other reasons (e.g., their buffer reaching capacity). So, this buffering policy may not be the only source of flushes.

    Each of the policies has two flavors. The first is a trait that can be used to mixin to a StackableReceiver. The second is an object that can be used as an argument to the file() method in the DSL.

    Definition Classes
    receiver
  • package concurrency

    Contains the composable Receiver concurrency policies available in timber.

    Contains the composable Receiver concurrency policies available in timber. These determine whether concurrent access to the various Receiver methods is allowed.

    Each of the policies has two flavors. The first is a trait that can be used to mixin to a StackableReceiver. The second is an object that can be used as an argument to the file() method in the DSL.

    Definition Classes
    receiver
  • 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.

  • package timestamp

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

  • DefaultEntryFormatter
  • EntryFormatter
  • Formatter
  • MessageOnlyEntryFormatter
  • ProgrammableEntryFormatter

package formatter

Contains functionality for turning log entries into text.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. formatter
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package level

    Contains functionality for turning log Levels into text.

  2. package timestamp

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

Type Members

  1. trait EntryFormatter extends Formatter[Entry]

    Converts an Entry into text.

  2. trait Formatter[-T] extends AnyRef

    Converts something into text.

    Converts something into text. Implementations of this trait must be thread-safe.

    T

    the type of object that this formatter can turn into text.

  3. class ProgrammableEntryFormatter extends EntryFormatter

    Formats entries using the specified metadata providers to create a header.

    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.

Value Members

  1. object DefaultEntryFormatter extends ProgrammableEntryFormatter

    Formats the entries for receivers that require a formatter and don't specify an alternate.

  2. object MessageOnlyEntryFormatter extends EntryFormatter
  3. object ProgrammableEntryFormatter

    Most of the declarations in this object should be used through the DSL.

    Most of the declarations in this object should be used through the DSL. See ProgrammableEntryFormatter for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped