example for Streams log operator (#25283)
* and added all log levels in Attributes for convenient single access point
This commit is contained in:
parent
33904de972
commit
02f6899952
4 changed files with 84 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue