jodd.log.Logger.log()方法的使用及代码示例

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

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

Logger.log介绍

[英]Logs a message at provided logging level.
[中]以提供的日志级别记录消息。

代码示例

代码示例来源:origin: oblac/jodd

/**
 * Logs a message and displays exception info.
 */
default void log(final Level level, final Supplier<String> messageSupplier, final Throwable throwable) {
  if (isEnabled(level)) {
    log(level, messageSupplier.get(), throwable);
  }
}

代码示例来源:origin: oblac/jodd

/**
 * Logs a message at provided logging level.
 */
default void log(final Level level, final Supplier<String> messageSupplier) {
  if (isEnabled(level)) {
    log(level, messageSupplier.get());
  }
}

代码示例来源:origin: oblac/jodd

@Override
public void error(final String message) {
  rootNode.addError(message);
  log.log(domBuilder.config.getParsingErrorLogLevel(), message);
}

代码示例来源:origin: oblac/jodd

@Test
void testLog() {
  //when
  logger.log(Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(java.util.logging.Level.FINER, LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(java.util.logging.Level.FINE, LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(java.util.logging.Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(java.util.logging.Level.WARNING, LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(java.util.logging.Level.SEVERE, LoggerConstants.SIMPLE_MESSAGE);
}

代码示例来源:origin: oblac/jodd

@Test
void testLog() {
  //when
  logger.log(Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).trace(LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).debug(LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).info(LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).warn(LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).error(LoggerConstants.SIMPLE_MESSAGE);
}

代码示例来源:origin: oblac/jodd

@Test
void testLog() {
  //when
  logger.log(Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).trace(LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).debug(LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).info(LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).warn(LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).error(LoggerConstants.SIMPLE_MESSAGE);
}

代码示例来源:origin: oblac/jodd

@Test
void testLog() {
  //when
  logger.log(Logger.Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Logger.Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Logger.Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Logger.Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  //when
  logger.log(Logger.Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  //then
  verify(log).log(Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
}

代码示例来源:origin: oblac/jodd

@Test
void testLog() {
  //given
  setUpOutputStream();
  //when
  logger.log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  //then
  output = outputStream.toString();
  assertTrue(output.contains(LoggerConstants.SIMPLE_MESSAGE));
}

代码示例来源:origin: oblac/jodd

@Test
void testLog() {
  //given
  throwable = mock(Throwable.class);
  //when
  //The below methods are no op methods in actual implementations.
  //so we will not be able to verify anything
  logger.log(Level.DEBUG, name);
  logger.trace(name);
  logger.debug(name);
  logger.info(name);
  logger.warn(name);
  logger.warn(name, throwable);
  logger.error(name);
  logger.error(name, throwable);
}

代码示例来源:origin: org.jodd/jodd-log

/**
 * Logs a message and displays exception info.
 */
default void log(final Level level, final Supplier<String> messageSupplier, final Throwable throwable) {
  if (isEnabled(level)) {
    log(level, messageSupplier.get(), throwable);
  }
}

代码示例来源:origin: org.jodd/jodd-log

/**
 * Logs a message at provided logging level.
 */
default void log(final Level level, final Supplier<String> messageSupplier) {
  if (isEnabled(level)) {
    log(level, messageSupplier.get());
  }
}

代码示例来源:origin: org.jodd/jodd-lagarto

@Override
public void error(final String message) {
  rootNode.addError(message);
  log.log(domBuilder.config.getParsingErrorLogLevel(), message);
}

相关文章