Logging is one of the most common ways to know what is happening underneath method invocations. Reactor uses SLF4J for logging, but it does not log stream operations out-of-the-box. Instead, Reactor provides the log operator, which can be used to selectively enable logging for a particular stream. Let's modify our test case using the log operator as follows:
@Testpublic void testPublisherStub() throws Exception { Flux<Long> fibonacciGenerator = getFibonacciGenerator().log(); StringWriter out = new StringWriter(); new PrintService().printEventNumbers(fibonacciGenerator, new PrintWriter(out)); assertTrue(out.getBuffer().length() >0);}
The log() operator is offered in many variants. By default, the operator logs at the INFO level. ...