log

Log elements flowing through the stream as well as completion and erroring.

Simple operators

Signature

def log(name: String, extract: Out => Any = ConstantFun.scalaIdentityFunction)(implicit log: LoggingAdapter = null): Repr[Out]

Description

Log elements flowing through the stream as well as completion and erroring. By default element and completion signals are logged on debug level, and errors are logged on Error level. This can be changed by calling Attributes.logLevels(...) Attributes.createLogLevels(...) on the given Flow.

Example

Scala
sourceimport akka.stream.Attributes

  .log(name = "myStream")
  .addAttributes(
    Attributes.logLevels(
      onElement = Attributes.LogLevels.Off,
      onFailure = Attributes.LogLevels.Error,
      onFinish = Attributes.LogLevels.Info))
Java
sourceimport akka.stream.Attributes;
import akka.stream.javadsl.Source;
.log("myStream")
.addAttributes(
    Attributes.createLogLevels(
        Attributes.logLevelOff(), // onElement
        Attributes.logLevelError(), // onFailure
        Attributes.logLevelInfo())) // onFinish

Reactive Streams semantics

emits when upstream emits

backpressures when downstream backpressures

completes when upstream completes

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.