example for Streams log operator (#25283)

* and added all log levels in Attributes for convenient single access point
This commit is contained in:
Patrik Nordwall 2018-06-30 05:10:10 +02:00 committed by Konrad `ktoso` Malawski
parent 33904de972
commit 02f6899952
4 changed files with 84 additions and 2 deletions

View file

@ -0,0 +1,29 @@
/**
* Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com>
*/
package docs.stream.operators
import akka.stream.scaladsl._
//
object SourceOrFlow {
def logExample(): Unit = {
//#log
import akka.stream.Attributes
//#log
Flow[String]
//#log
.log(name = "myStream")
.addAttributes(Attributes.logLevels(
onElement = Attributes.LogLevels.Off,
onFailure = Attributes.LogLevels.Error,
onFinish = Attributes.LogLevels.Info))
//#log
}
}