Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package scalawag
    Definition Classes
    org
  • package timber
    Definition Classes
    scalawag
  • package api
    Definition Classes
    timber
  • package impl
    Definition Classes
    api
  • package level

    Contains composable traits that can be used to add many common level-specific log methods to your custom loggers.

    Contains composable traits that can be used to add many common level-specific log methods to your custom loggers. They are inspired by various legacy logging technologies.

    Each trait defines several methods for logging and level val that can be overridden to control the level at which those methods log entries. See Logger for an example.

    Another example that mixes in a ridiculous set of level methods:

    import org.scalawag.timber.api
    import org.scalawag.timber.api.Dispatcher
    import org.scalawag.timber.api.level._
    
    class Logger(override val attributes:Map[String,Any] = Map.empty, override val tags:Set[Tag] = Set.empty)(implicit dispatcher: Dispatcher)
      extends BaseLogger(attributes, tags)(dispatcher) with Emergency with Finest with Warning with Warn
    Definition Classes
    api
  • package style
    Definition Classes
    api
  • BaseLogger
  • Dispatcher
  • Entry
  • ImmediateMessage
  • Level
  • Logger
  • Message
  • Tag
  • ThreadAttributes
o

org.scalawag.timber.api

ThreadAttributes

object ThreadAttributes

Provides a convenient mechanism for associating thread-specific attributes with your log entries. Loggers will copy the thread-specific attributes available through this object (ThreadAttributes.get()) into the threadAttributes field of every entry they create.

Thread attribute values are stacked, making it possible to push an attribute value for a specific code block and then pop the value from the attribute stack, leaving the thread attributes in the state that was present before the block was executed. This is directly implemented in the during() method calls. It can also be managed explicitly by the calling code (e.g., when the push and pop operations need to span method bodies) using the push and pop methods.

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

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 clear: Unit

    Removes all thread attributes.

    Removes all thread attributes. This includes all stacked values.

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. def during[A](attributes: Map[String, String])(fn: => A): A

    Executes a thunk, during which the specified thread attributes will be in place.

    Executes a thunk, during which the specified thread attributes will be in place. After the thunk has completed, the thread attributes are returned to their original values (before the call to during). The return value of the call is the return value of the thunk.

    A

    the return type of the thunk

    attributes

    the thread attribute names and values to push during the thunk execution

    fn

    the thunk to execute

    returns

    the return value of the executed thunk

  8. def during[A](name: String, value: String)(fn: => A): A

    Executes a thunk, during which the specified thread attribute will be in place.

    Executes a thunk, during which the specified thread attribute will be in place. After the thunk has completed, the thread attribute is returned to its original value (before the call to during). The return value of the call is the return value of the thunk.

    A

    the return type of the thunk

    name

    the name of the thread attribute to set

    value

    the value of the named thread attribute

    fn

    the thunk to execute

    returns

    the return value of the executed thunk

  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. def get: Map[String, List[String]]

    Retrieves the current thread attributes.

    Retrieves the current thread attributes.

    returns

    the stack of values for each attribute on this thread as a map of lists

  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def getTopmost: Map[String, String]

    Retrieves the current thread attributes.

    Retrieves the current thread attributes.

    returns

    the topmost value on the stack for each attribute on this thread as a map

  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def pop(attributes: Map[String, String]): Unit

    Pops a collection of old values from the stacks for the named thread attributes.

    Pops a collection of old values from the stacks for the named thread attributes. The expected values must match the values on tops of the stacks, or else an exception will be thrown. This is to protect against programming errors where the push and pop calls don't match up.

    attributes

    a map of the thread attribute names to pop and the expected value for each

  21. def pop(name: String, value: String): Unit

    Pops an old value from the stack for the named thread attribute.

    Pops an old value from the stack for the named thread attribute. The expected value must be specified and, if it does not match the value on top of the stack, will throw an exception. This is to protect against programming errors where the push and pop calls don't match up.

    name

    the name of the attribute for which to pop a value

    value

    the expected value to pop for the named attribute

  22. def push(attributes: Map[String, String]): Unit

    Pushes a collection of values onto the stacks of several thread attributes.

    Pushes a collection of values onto the stacks of several thread attributes.

    attributes

    the thread attribute names and values to push

  23. def push(name: String, value: String): Unit

    Pushes a new value onto the stack for the named thread attribute.

    Pushes a new value onto the stack for the named thread attribute.

    name

    the name of the attribute for which to push a value

    value

    the value to push for the named attribute

  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped