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

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

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

Logger.isErrorEnabled介绍

[英]Returns true if ERROR level is enabled.
[中]如果启用了错误级别,则返回true

代码示例

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

/**
 * Logs a message at ERROR level.
 */
default void error(final Supplier<String> messageSupplier) {
  if (isErrorEnabled()) {
    error(messageSupplier.get());
  }
}

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

/**
 * Logs a message at ERROR level.
 */
default void error(final Supplier<String> messageSupplier, final Throwable throwable) {
  if (isErrorEnabled()) {
    error(messageSupplier.get(), throwable);
  }
}

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

@Test
void testIsLevelEnabled() {
  // Loggers does not provide any API to enable levels.
  // Instead we need to use log/level(trace/debug etc) API to log information into corresponding level
  assertFalse(logger.isTraceEnabled());
  assertFalse(logger.isDebugEnabled());
  assertFalse(logger.isInfoEnabled());
  assertFalse(logger.isWarnEnabled());
  assertFalse(logger.isErrorEnabled());
}

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

@Override
@Test
void testIsLevelEnabled() {
  //when
  initializeLogFactoryAndLogger(Logger.Level.DEBUG);
  //then 
  assertTrue(logger.isDebugEnabled());
  //when
  initializeLogFactoryAndLogger(Logger.Level.ERROR);
  //then 
  assertTrue(logger.isErrorEnabled());
  //when
  initializeLogFactoryAndLogger(Logger.Level.INFO);
  //then 
  assertTrue(logger.isInfoEnabled());
  //when
  initializeLogFactoryAndLogger(Logger.Level.TRACE);
  //then 
  assertTrue(logger.isTraceEnabled());
  //when
  initializeLogFactoryAndLogger(Logger.Level.WARN);
  //then 
  assertTrue(logger.isWarnEnabled());
}

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

/**
 * Logs a message at ERROR level.
 */
default void error(final Supplier<String> messageSupplier) {
  if (isErrorEnabled()) {
    error(messageSupplier.get());
  }
}

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

/**
 * Logs a message at ERROR level.
 */
default void error(final Supplier<String> messageSupplier, final Throwable throwable) {
  if (isErrorEnabled()) {
    error(messageSupplier.get(), throwable);
  }
}

相关文章