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,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
|
||||
;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue