Object

org.scalawag.timber.api

ThreadAttributes

Related Doc: package api

Permalink

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. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clear: Unit

    Permalink

    Removes all thread attributes.

    Removes all thread attributes. This includes all stacked values.

  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def during[A](attributes: Map[String, String])(fn: ⇒ A): A

    Permalink

    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

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def get: Map[String, List[String]]

    Permalink

    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[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def getTopmost: Map[String, String]

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. def pop(attributes: Map[String, String]): Unit

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  25. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped