reactor.util.Logger.info()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(206)

本文整理了Java中reactor.util.Logger.info()方法的一些代码示例,展示了Logger.info()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.info()方法的具体详情如下:
包路径:reactor.util.Logger
类名称:Logger
方法名:info

Logger.info介绍

[英]Log a message at the INFO level.
[中]在信息级别记录消息。

代码示例

代码示例来源:origin: reactor/reactor-core

@Override
public void onComplete() {
  log.info("fluxion complete");
}

代码示例来源:origin: reactor/reactor-core

public Consumer<Object> loggingConsumer() {
    return m -> LOG.info("(int) msg={}", m);
  }
/*

代码示例来源:origin: reactor/reactor-core

@Override
public void info(String msg, Throwable t) {
  delegate.info(msg, t);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void info(String msg) {
  delegate.info(msg);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void onNext(String s) {
  if (s.startsWith("GOODBYE")) {
    log.info("This is the end");
  }
  subscription.request(1);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void info(String format, Object... arguments) {
  delegate.info(format, wrapArguments(arguments));
}

代码示例来源:origin: reactor/reactor-core

@Test
public void info() throws Exception {
  logger.info("message");
  assertThat(errContent.size()).isZero();
  assertThat(outContent.toString()).isEqualTo("[ INFO] (" + Thread.currentThread().getName() + ") message\n");
}

代码示例来源:origin: reactor/reactor-core

@Test
public void formatNull() {
  logger.info(null, null, null);
  assertThat(errContent.size()).isZero();
  assertThat(outContent.toString())
      .isEqualTo("[ INFO] (" + Thread.currentThread().getName() + ") null\n");
}

代码示例来源:origin: reactor/reactor-core

@Test
public void info1() throws Exception {
  logger.info("message {} {} format", "with", 1);
  assertThat(errContent.size()).isZero();
  assertThat(outContent.toString()).isEqualTo("[ INFO] (" + Thread.currentThread().getName() + ") message with 1 format\n");
}

代码示例来源:origin: reactor/reactor-core

@Test
public void infoNulls() {
  logger.info("vararg {} is {}", (Object[]) null);
  logger.info("param {} is {}", null, null);
  assertThat(errContent.size()).isZero();
  assertThat(outContent.toString())
      .contains("vararg {} is {}")
      .contains("param null is null");
}

代码示例来源:origin: reactor/reactor-core

@Test
public void info2() throws Exception {
  logger.info("with cause", CAUSE);
  assertThat(errContent.size()).isZero();
  assertThat(outContent.toString())
      .startsWith("[ INFO] (" + Thread.currentThread().getName() + ") with cause - java.lang.IllegalStateException: cause" +
          "\njava.lang.IllegalStateException: cause\n" +
          "\tat reactor.util.ConsoleLoggerTest");
}

代码示例来源:origin: reactor/reactor-core

/**
 * Structured logging with level adaptation and operator ascii graph if required.
 *
 * @param signalType the type of signal being logged
 * @param signalValue the value for the signal (use empty string if not required)
 */
void log(SignalType signalType, Object signalValue) {
  String line = fuseable ? LOG_TEMPLATE_FUSEABLE : LOG_TEMPLATE;
  if (operatorLine != null) {
    line = line + " " + operatorLine;
  }
  if (level == Level.FINEST) {
    log.trace(line, signalType, signalValue);
  }
  else if (level == Level.FINE) {
    log.debug(line, signalType, signalValue);
  }
  else if (level == Level.INFO) {
    log.info(line, signalType, signalValue);
  }
  else if (level == Level.WARNING) {
    log.warn(line, signalType, signalValue);
  }
  else if (level == Level.SEVERE) {
    log.error(line, signalType, signalValue);
  }
}

代码示例来源:origin: reactor/reactor-core

.doOnNext(v -> LOGGER.info(v.toString()))
.doOnComplete(latch::countDown)
.collectList();

代码示例来源:origin: reactor/reactor-core

@Test
public void sampleTest() throws Exception {
  CountDownLatch latch = new CountDownLatch(1);
  Disposable top10every1second =
   Flux.fromIterable(PULP_SAMPLE)
       .publishOn(asyncGroup)
       .flatMap(samuelJackson ->
      Flux
       .fromArray(samuelJackson.split(" "))
       .publishOn(asyncGroup)
       .filter(w -> !w.trim().isEmpty())
       .doOnNext(i -> simulateLatency())
    )
       .window(Duration.ofSeconds(2))
       .flatMap(s -> s.groupBy(w -> w)
              .flatMap(w -> w.count().map(c -> Tuples.of(w.key(), c)))
              .collectSortedList((a, b) -> -a.getT2().compareTo(b.getT2()))
              .flatMapMany(Flux::fromIterable)
              .take(10)
              .doAfterTerminate(() -> LOG.info("------------------------ window terminated" +
             "----------------------"))
    )
       .subscribe(
     entry -> LOG.info(entry.getT1() + ": " + entry.getT2()),
     error -> LOG.error("", error),
          latch::countDown
    );
  awaitLatch(top10every1second, latch);
}

代码示例来源:origin: io.projectreactor.addons/reactor-extra

/**
 * Reset the {@link #onHandleError(BiConsumer)} hook to the default no-op behavior.
 */
public static void resetOnHandleError() {
  log.info("Reset to default: onHandleError");
  onHandleErrorHook = null;
}

代码示例来源:origin: io.projectreactor.addons/reactor-extra

/**
 * Define a hook that is executed when a {@link Scheduler} has
 * {@link #handleError(Throwable) handled an error}. Note that it is executed after
 * the error has been passed to the thread uncaughtErrorHandler, which is not the
 * case when a fatal error occurs (see {@link Exceptions#throwIfJvmFatal(Throwable)}).
 *
 * @param c the new hook to set.
 */
public static void onHandleError(BiConsumer<Thread, ? super Throwable> c) {
  log.info("Hooking new: onHandleError");
  onHandleErrorHook = Objects.requireNonNull(c, "onHandleError");
}

代码示例来源:origin: io.projectreactor/reactor-netty

@Override
  protected void doComplete(Future<?> future, Subscriber<? super Void> s) {
    log.info("JOIN {}", multicastAddress);
    super.doComplete(future, s);
  }
};

代码示例来源:origin: reactor/reactor-netty

void log() {
    if (log.isInfoEnabled()) {
      log.info(COMMON_LOG_FORMAT, address, user, zonedDateTime,
          method, uri, protocol, status, (contentLength > -1 ? contentLength : MISSING), port, duration());
    }
  }
}

代码示例来源:origin: io.projectreactor.ipc/reactor-netty

void log() {
    if (log.isInfoEnabled()) {
      log.info(COMMON_LOG_FORMAT, address, user, zonedDateTime,
          method, uri, protocol, status, (contentLength > -1 ? contentLength : MISSING), port, duration());
    }
  }
}

代码示例来源:origin: io.projectreactor.ipc/reactor-netty

public BlockingNettyContext(Mono<? extends NettyContext> contextAsync,
    String description, Duration lifecycleTimeout) {
  this.description = description;
  this.lifecycleTimeout = lifecycleTimeout;
  this.context = contextAsync
      .timeout(lifecycleTimeout, Mono.error(new TimeoutException(description + " couldn't be started within " + lifecycleTimeout.toMillis() + "ms")))
      .doOnNext(ctx -> LOG.info("Started {} on {}", description, ctx.address()))
      .block();
}

相关文章