Packages

  • package root
    Definition Classes
    root
  • package net
    Definition Classes
    root
  • package liftweb
    Definition Classes
    net
  • package common
    Definition Classes
    liftweb
  • trait BoxLogging extends AnyRef

    Mix this trait in to get some low-cost implicits for logging boxes easily.

    Mix this trait in to get some low-cost implicits for logging boxes easily. The consumer will need to implement a logBoxError method to log messages with an optional Throwable, as well as its related friends for trace, debug, info, and warn levels. This allows abstracting out where and what the actual logger is.

    With this mixed in, boxes will have logFailure and logFailure methods. The first logs all Failures as well as Empty. The second logs only Failures and ParamFailures, treating Empty as a valid value. These both log their respective items at ERROR level. You can also use traceLog*, debugLog*, infoLog*, and warnLog* if you want to log at other levels (e.g., you can use infoLogFailure to log an Empty or Failure at INFO level).

    All of these return the box unchanged, so you can continue to use it in for comprehensions, call openOr on it, etc.

    There is an implementation for anyone who wants to use Lift's Loggable trait called LoggableBoxLogging. Another implementaiton is available for use with a plain SLF4J logger, SLF4JBoxLogging. You can also implement a version for any other logging adapter. Lastly, you can simply import BoxLogging._ to get the methods available at a top level; however, note that using them this way will lose information about where the log message came from.

    Here is an example of how you might use this in system that executes a third- party service and notifies another system of failures.

    val systemResult: Box[ServiceReturn] =
      system
        .executeService(true, requester)
        .map(...)
        .logFailure("Failed to execute service") match {
          case Full(content) =>
            content
          case failure: Failure =>
            otherSystem.notifyFailure(failure)
          case Empty =>
            otherSystem.notifyFailure(Failure("No idea what happened."))
        }
    Definition Classes
    common
  • LogEmptyOrFailure
c

net.liftweb.common.BoxLogging

LogEmptyOrFailure

implicit class LogEmptyOrFailure[T] extends AnyRef

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

Instance Constructors

  1. new LogEmptyOrFailure(box: Box[T])

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. val box: Box[T]
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def debugLogEmptyBox(message: String): Box[T]
  8. def debugLogFailure(message: String): Box[T]
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  14. def infoLogEmptyBox(message: String): Box[T]
  15. def infoLogFailure(message: String): Box[T]
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. def logEmptyBox(message: String): Box[T]
  18. def logFailure(message: String): Box[T]
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  22. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. def traceLogEmptyBox(message: String): Box[T]
  25. def traceLogFailure(message: String): Box[T]
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. def warnLogEmptyBox(message: String): Box[T]
  30. def warnLogFailure(message: String): Box[T]

Inherited from AnyRef

Inherited from Any

Ungrouped