akka.stream.extra

Log

class Log[T] extends Transformer[T, T] with TransformerLogging

Logs the elements, error and completion of a a flow.

By default it logs onNext and onComplete at info log level, and onError at error log level. Subclass may customize the logging by overriding #logOnNext, #logOnComplete and #logOnError.

The logSource of the akka.event.Logging.LogEvent is the path of the actor processing this step in the flow. It contains the flow name and the #name of this Transformer. The name can be customized with the #name constructor parameter.

The akka.event.LoggingAdapter is accessible under the name log.

Usage:

Flow(List(1, 2, 3)).transform(new Log[Int](name = "mylog") {
  override def logOnNext(i: Int): Unit =
    log.debug("Got element {}", i)
}).
consume(materializer)

Or with the implicit enrichment:

import akka.stream.extra.Implicits._
Flow(List(1, 2, 3)).log().consume(materializer)
Source
Log.scala
Linear Supertypes
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Log
  2. TransformerLogging
  3. Transformer
  4. AnyRef
  5. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Log(name: String = "log")

Value Members

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

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

    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from Log[T] to any2stringadd[Log[T]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Log[T], B)

    Implicit information
    This member is added by an implicit conversion from Log[T] to ArrowAssoc[Log[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

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

    Definition Classes
    Any
  7. def cleanup(): Unit

    Invoked after normal completion or error.

    Invoked after normal completion or error.

    Definition Classes
    Transformer
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def ensuring(cond: (Log[T]) ⇒ Boolean, msg: ⇒ Any): Log[T]

    Implicit information
    This member is added by an implicit conversion from Log[T] to Ensuring[Log[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (Log[T]) ⇒ Boolean): Log[T]

    Implicit information
    This member is added by an implicit conversion from Log[T] to Ensuring[Log[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: ⇒ Any): Log[T]

    Implicit information
    This member is added by an implicit conversion from Log[T] to Ensuring[Log[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): Log[T]

    Implicit information
    This member is added by an implicit conversion from Log[T] to Ensuring[Log[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from Log[T] to StringFormat[Log[T]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  17. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  19. final def isComplete: Boolean

    Invoked after handing off the elements produced from one input element to the downstream consumers to determine whether to end stream processing at this point; in that case the upstream subscription is canceled.

    Invoked after handing off the elements produced from one input element to the downstream consumers to determine whether to end stream processing at this point; in that case the upstream subscription is canceled.

    Definition Classes
    LogTransformer
  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. def log: LoggingAdapter

    Definition Classes
    TransformerLogging
  22. def logOnComplete(): Unit

  23. def logOnError(cause: Throwable): Unit

  24. def logOnNext(element: T): Unit

  25. val name: String

    Name of this transformation step.

    Name of this transformation step. Used as part of the actor name. Facilitates debugging and logging.

    Definition Classes
    LogTransformer
  26. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  27. final def notify(): Unit

    Definition Classes
    AnyRef
  28. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  29. final def onError(cause: Throwable): Unit

    Invoked when failure is signaled from upstream.

    Invoked when failure is signaled from upstream. If this method throws an exception, then onError is immediately propagated downstream. If this method completes normally then Transformer#onTermination is invoked as a final step, passing the original cause.

    Definition Classes
    LogTransformer
  30. final def onNext(element: T): Seq[T]

    Invoked for each element to produce a (possibly empty) sequence of output elements.

    Invoked for each element to produce a (possibly empty) sequence of output elements.

    Definition Classes
    LogTransformer
  31. final def onTermination(e: Option[Throwable]): Seq[T]

    Invoked before the Transformer terminates (either normal completion or after an onError) to produce a (possibly empty) sequence of elements in response to the end-of-stream event.

    Invoked before the Transformer terminates (either normal completion or after an onError) to produce a (possibly empty) sequence of elements in response to the end-of-stream event.

    This method is only called if Transformer#onError does not throw an exception. The default implementation of Transformer#onError throws the received cause forcing the error to propagate downstream immediately.

    e

    Contains a non-empty option with the error causing the termination or an empty option if the Transformer was completed normally

    Definition Classes
    LogTransformer
  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  33. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. def [B](y: B): (Log[T], B)

    Implicit information
    This member is added by an implicit conversion from Log[T] to ArrowAssoc[Log[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from TransformerLogging

Inherited from Transformer[T, T]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Log[T] to any2stringadd[Log[T]]

Inherited by implicit conversion StringFormat from Log[T] to StringFormat[Log[T]]

Inherited by implicit conversion Ensuring from Log[T] to Ensuring[Log[T]]

Inherited by implicit conversion ArrowAssoc from Log[T] to ArrowAssoc[Log[T]]

Ungrouped