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

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

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

  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. @Override
  2. public void error(final String message) {
  3. rootNode.addError(message);
  4. log.log(domBuilder.config.getParsingErrorLogLevel(), message);
  5. }

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

  1. @Test
  2. void testLog() {
  3. //when
  4. logger.log(Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  5. //then
  6. verify(log).log(java.util.logging.Level.FINER, LoggerConstants.SIMPLE_MESSAGE);
  7. //when
  8. logger.log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  9. //then
  10. verify(log).log(java.util.logging.Level.FINE, LoggerConstants.SIMPLE_MESSAGE);
  11. //when
  12. logger.log(Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  13. //then
  14. verify(log).log(java.util.logging.Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  15. //when
  16. logger.log(Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  17. //then
  18. verify(log).log(java.util.logging.Level.WARNING, LoggerConstants.SIMPLE_MESSAGE);
  19. //when
  20. logger.log(Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  21. //then
  22. verify(log).log(java.util.logging.Level.SEVERE, LoggerConstants.SIMPLE_MESSAGE);
  23. }

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

  1. @Test
  2. void testLog() {
  3. //when
  4. logger.log(Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  5. //then
  6. verify(log).trace(LoggerConstants.SIMPLE_MESSAGE);
  7. //when
  8. logger.log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  9. //then
  10. verify(log).debug(LoggerConstants.SIMPLE_MESSAGE);
  11. //when
  12. logger.log(Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  13. //then
  14. verify(log).info(LoggerConstants.SIMPLE_MESSAGE);
  15. //when
  16. logger.log(Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  17. //then
  18. verify(log).warn(LoggerConstants.SIMPLE_MESSAGE);
  19. //when
  20. logger.log(Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  21. //then
  22. verify(log).error(LoggerConstants.SIMPLE_MESSAGE);
  23. }

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

  1. @Test
  2. void testLog() {
  3. //when
  4. logger.log(Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  5. //then
  6. verify(log).trace(LoggerConstants.SIMPLE_MESSAGE);
  7. //when
  8. logger.log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  9. //then
  10. verify(log).debug(LoggerConstants.SIMPLE_MESSAGE);
  11. //when
  12. logger.log(Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  13. //then
  14. verify(log).info(LoggerConstants.SIMPLE_MESSAGE);
  15. //when
  16. logger.log(Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  17. //then
  18. verify(log).warn(LoggerConstants.SIMPLE_MESSAGE);
  19. //when
  20. logger.log(Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  21. //then
  22. verify(log).error(LoggerConstants.SIMPLE_MESSAGE);
  23. }

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

  1. @Test
  2. void testLog() {
  3. //when
  4. logger.log(Logger.Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  5. //then
  6. verify(log).log(Level.TRACE, LoggerConstants.SIMPLE_MESSAGE);
  7. //when
  8. logger.log(Logger.Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  9. //then
  10. verify(log).log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  11. //when
  12. logger.log(Logger.Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  13. //then
  14. verify(log).log(Level.INFO, LoggerConstants.SIMPLE_MESSAGE);
  15. //when
  16. logger.log(Logger.Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  17. //then
  18. verify(log).log(Level.WARN, LoggerConstants.SIMPLE_MESSAGE);
  19. //when
  20. logger.log(Logger.Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  21. //then
  22. verify(log).log(Level.ERROR, LoggerConstants.SIMPLE_MESSAGE);
  23. }

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

  1. @Test
  2. void testLog() {
  3. //given
  4. setUpOutputStream();
  5. //when
  6. logger.log(Level.DEBUG, LoggerConstants.SIMPLE_MESSAGE);
  7. //then
  8. output = outputStream.toString();
  9. assertTrue(output.contains(LoggerConstants.SIMPLE_MESSAGE));
  10. }

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

  1. @Test
  2. void testLog() {
  3. //given
  4. throwable = mock(Throwable.class);
  5. //when
  6. //The below methods are no op methods in actual implementations.
  7. //so we will not be able to verify anything
  8. logger.log(Level.DEBUG, name);
  9. logger.trace(name);
  10. logger.debug(name);
  11. logger.info(name);
  12. logger.warn(name);
  13. logger.warn(name, throwable);
  14. logger.error(name);
  15. logger.error(name, throwable);
  16. }

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

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

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

相关文章