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

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

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

Logger.isEnabled介绍

[英]Returns true if certain logging level is enabled.
[中]如果启用了某些日志记录级别,则返回true

代码示例

代码示例来源: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

@Test
  void testIsEnabled() {
    // 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.isEnabled(Level.TRACE));
    assertFalse(logger.isEnabled(Level.DEBUG));
    assertFalse(logger.isEnabled(Level.INFO));
    assertFalse(logger.isEnabled(Level.WARN));
    assertFalse(logger.isEnabled(Level.ERROR));
  }
}

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

@Override
@Test
void testIsEnabled() {
  assertTrue(logger.isEnabled(Level.DEBUG));
}

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

@Override
@Test
void testIsEnabled() {
  assertFalse(logger.isEnabled(Level.DEBUG));
}

代码示例来源: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());
  }
}

相关文章