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

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

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

Logger.isTraceEnabled介绍

[英]Returns true if TRACE level is enabled.
[中]如果启用跟踪级别,则返回true

代码示例

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

/**
 * Logs a message at TRACE level.
 */
default void trace(final Supplier<String> messageSupplier) {
  if (isTraceEnabled()) {
    trace(messageSupplier.get());
  }
}

代码示例来源: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 TRACE level.
 */
default void trace(final Supplier<String> messageSupplier) {
  if (isTraceEnabled()) {
    trace(messageSupplier.get());
  }
}

相关文章