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

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

本文整理了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

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

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

  1. /**
  2. * Logs a message at provided logging level.
  3. */
  4. default void log(final Level level, final Supplier<String> messageSupplier) {
  5. if (isEnabled(level)) {
  6. log(level, messageSupplier.get());
  7. }
  8. }

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

  1. @Test
  2. void testIsEnabled() {
  3. // Loggers does not provide any API to enable levels.
  4. // Instead we need to use log/level(trace/debug etc) API to log information into corresponding level
  5. assertFalse(logger.isEnabled(Level.TRACE));
  6. assertFalse(logger.isEnabled(Level.DEBUG));
  7. assertFalse(logger.isEnabled(Level.INFO));
  8. assertFalse(logger.isEnabled(Level.WARN));
  9. assertFalse(logger.isEnabled(Level.ERROR));
  10. }
  11. }

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

  1. @Override
  2. @Test
  3. void testIsEnabled() {
  4. assertTrue(logger.isEnabled(Level.DEBUG));
  5. }

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

  1. @Override
  2. @Test
  3. void testIsEnabled() {
  4. assertFalse(logger.isEnabled(Level.DEBUG));
  5. }

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

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

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

  1. /**
  2. * Logs a message at provided logging level.
  3. */
  4. default void log(final Level level, final Supplier<String> messageSupplier) {
  5. if (isEnabled(level)) {
  6. log(level, messageSupplier.get());
  7. }
  8. }

相关文章