/** * Observe all Reactive Streams signals and use {@link Logger} support to handle trace * implementation. Default will use {@link Level#INFO} and java.util.logging. If SLF4J * is available, it will be used instead. * <p> * <img class="marble" src="doc-files/marbles/logForFlux.svg" alt=""> * <p> * The default log category will be "reactor.*", a generated operator suffix will * complete, e.g. "reactor.Parallel.Map". * * @return a new unaltered {@link ParallelFlux} */ public final ParallelFlux<T> log() { return log(null, Level.INFO); }
/** * Observe all Reactive Streams signals and use {@link Logger} support to handle trace * implementation. Default will use {@link Level#INFO} and java.util.logging. If SLF4J * is available, it will be used instead. * <p> * <img class="marble" src="doc-files/marbles/logForFlux.svg" alt=""> * <p> * * @param category to be mapped into logger configuration (e.g. org.springframework * .reactor). If category ends with "." like "reactor.", a generated operator suffix * will complete, e.g. "reactor.Parallel.Map". * * @return a new unaltered {@link ParallelFlux} */ public final ParallelFlux<T> log(@Nullable String category) { return log(category, Level.INFO); }
/** * Observe Reactive Streams signals matching the passed filter {@code options} and use * {@link Logger} support to handle trace implementation. Default will use the passed * {@link Level} and java.util.logging. If SLF4J is available, it will be used * instead. * <p> * Options allow fine grained filtering of the traced signal, for instance to only * capture onNext and onError: * <pre> * ParallelFlux.log("category", Level.INFO, SignalType.ON_NEXT, * SignalType.ON_ERROR) * * <p> * <img class="marble" src="doc-files/marbles/logForFlux.svg" alt=""> * * @param category to be mapped into logger configuration (e.g. org.springframework * .reactor). If category ends with "." like "reactor.", a generated operator * suffix will complete, e.g. "reactor.Parallel.Map". * @param level the {@link Level} to enforce for this tracing ParallelFlux (only * FINEST, FINE, INFO, WARNING and SEVERE are taken into account) * @param options a vararg {@link SignalType} option to filter log messages * * @return a new unaltered {@link ParallelFlux} */ public final ParallelFlux<T> log(@Nullable String category, Level level, SignalType... options) { return log(category, level, false, options); }
@Test public void asChangesParallelism() { assertThat(ParallelFlux.from(Flux.range(1, 10), 3) .as(pf -> ParallelFlux.from(pf.sequential(), 5) .log("secondParallel")) .parallelism()) .isEqualTo(5); }
@Test public void transformChangesPrefetch() { assertThat(ParallelFlux.from(Flux.range(1, 10), 3, 12, Queues.small()) .transform(pf -> pf.runOn(Schedulers.parallel(), 3) .log() .hide()) .getPrefetch()) .isEqualTo(3); }
.runOn(scheduler) .map(v -> v + 1) .log("test", Level.INFO, true, SignalType.ON_SUBSCRIBE) .sequential();
/** * Observe all Reactive Streams signals and use {@link Logger} support to handle trace * implementation. Default will use {@link Level#INFO} and java.util.logging. If SLF4J * is available, it will be used instead. * <p> * <img class="marble" src="doc-files/marbles/logForFlux.svg" alt=""> * <p> * The default log category will be "reactor.*", a generated operator suffix will * complete, e.g. "reactor.Parallel.Map". * * @return a new unaltered {@link ParallelFlux} */ public final ParallelFlux<T> log() { return log(null, Level.INFO); }
/** * Observe all Reactive Streams signals and use {@link Logger} support to handle trace * implementation. Default will use {@link Level#INFO} and java.util.logging. If SLF4J * is available, it will be used instead. * <p> * <img class="marble" src="doc-files/marbles/logForFlux.svg" alt=""> * <p> * * @param category to be mapped into logger configuration (e.g. org.springframework * .reactor). If category ends with "." like "reactor.", a generated operator suffix * will complete, e.g. "reactor.Parallel.Map". * * @return a new unaltered {@link ParallelFlux} */ public final ParallelFlux<T> log(@Nullable String category) { return log(category, Level.INFO); }
/** * Observe Reactive Streams signals matching the passed filter {@code options} and use * {@link Logger} support to handle trace implementation. Default will use the passed * {@link Level} and java.util.logging. If SLF4J is available, it will be used * instead. * <p> * Options allow fine grained filtering of the traced signal, for instance to only * capture onNext and onError: * <pre> * ParallelFlux.log("category", Level.INFO, SignalType.ON_NEXT, * SignalType.ON_ERROR) * * <p> * <img class="marble" src="doc-files/marbles/logForFlux.svg" alt=""> * * @param category to be mapped into logger configuration (e.g. org.springframework * .reactor). If category ends with "." like "reactor.", a generated operator * suffix will complete, e.g. "reactor.Parallel.Map". * @param level the {@link Level} to enforce for this tracing ParallelFlux (only * FINEST, FINE, INFO, WARNING and SEVERE are taken into account) * @param options a vararg {@link SignalType} option to filter log messages * * @return a new unaltered {@link ParallelFlux} */ public final ParallelFlux<T> log(@Nullable String category, Level level, SignalType... options) { return log(category, level, false, options); }