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,27 @@
/**
* Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com>
*/
package jdocs.stream.operators;
import akka.stream.javadsl.Flow;
//#log
import akka.stream.Attributes;
//#log
class SourceOrFlow {
void logExample() {
Flow.of(String.class)
//#log
.log("myStream")
.addAttributes(Attributes.createLogLevels(
Attributes.logLevelOff(), // onElement
Attributes.logLevelError(), // onFailure
Attributes.logLevelInfo())) // onFinish
//#log
;
}
}