Java Code Examples for org.asciidoctor.log.Severity#INFO

The following examples show how to use org.asciidoctor.log.Severity#INFO . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaLogger.java    From asciidoctorj with Apache License 2.0 6 votes vote down vote up
private Severity mapRubyLogLevel(IRubyObject arg) {
  final int rubyId = arg.convertToInteger().getIntValue();
  switch (rubyId) {
    case 0:
      return Severity.DEBUG;
    case 1:
      return Severity.INFO;
    case 2:
      return Severity.WARN;
    case 3:
      return Severity.ERROR;
    case 4:
      return Severity.FATAL;
    default:
      return Severity.UNKNOWN;
  }
}
 
Example 2
Source File: LogRecordHelperTest.java    From asciidoctor-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void should_apply_full_format_logRecord_with_all_data() {
    // given
    final Cursor cursor = new TestCursor(new File("file.adoc").getAbsolutePath(), 3, "path", "dir");
    final LogRecord logRecord = new LogRecord(Severity.INFO, cursor, "a message");
    final File sourceDir = getParentFile();
    // when
    String formattedLogRecord = LogRecordHelper.format(logRecord, sourceDir);
    // then
    assertThat(normalizePath(formattedLogRecord)).isEqualTo("asciidoctor: INFO: asciidoctor-maven-plugin/file.adoc: line 3: a message");
}
 
Example 3
Source File: LogRecordHelperTest.java    From asciidoctor-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void should_apply_simple_format_when_cursor_is_null() {
    // given
    final LogRecord logRecord = new LogRecord(Severity.INFO, null, "a message");
    // when
    String formattedLogRecord = LogRecordHelper.format(logRecord, null);
    // then
    assertThat(normalizePath(formattedLogRecord)).isEqualTo("asciidoctor: INFO: a message");
}
 
Example 4
Source File: LogRecordHelperTest.java    From asciidoctor-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void should_apply_simple_format_when_cursor_is_empty() {
    // given
    final Cursor cursor = new TestCursor(null, 0, null, null);
    final LogRecord logRecord = new LogRecord(Severity.INFO, cursor, "a message");
    // when
    String formattedLogRecord = LogRecordHelper.format(logRecord, null);
    // then
    assertThat(normalizePath(formattedLogRecord)).isEqualTo("asciidoctor: INFO: a message");
}
 
Example 5
Source File: LogRecordHelperTest.java    From asciidoctor-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void should_format_full_logRecord_with_file_absolute_path_when_sourceDir_is_not_valid() throws IOException {
    // given
    final Cursor cursor = new TestCursor(new File("file.adoc").getAbsolutePath(), 3, "path", "dir");
    final LogRecord logRecord = new LogRecord(Severity.INFO, cursor, "a message");
    final File sourceDir = Mockito.mock(File.class);
    Mockito.when(sourceDir.getCanonicalPath()).thenThrow(new IOException());

    // when
    String formattedLogRecord = LogRecordHelper.format(logRecord, sourceDir);
    // then
    assertThat(normalizePath(formattedLogRecord)).matches("asciidoctor: INFO: .*/asciidoctor-maven-plugin/file.adoc: line 3: a message");
}
 
Example 6
Source File: LogRecordHelperTest.java    From asciidoctor-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void should_format_logRecords_with_empty_lineNumber_absolute_path_when_sourceDir_is_not_valid2() throws IOException {
    // given
    final Cursor cursor = new TestCursor(new File("file.adoc").getAbsolutePath(), 0, "path", "dir");
    final LogRecord logRecord = new LogRecord(Severity.INFO, cursor, "a message");
    final File sourceDir = Mockito.mock(File.class);
    Mockito.when(sourceDir.getCanonicalPath()).thenThrow(new IOException());

    // when
    String formattedLogRecord = LogRecordHelper.format(logRecord, sourceDir);
    // then
    assertThat(normalizePath(formattedLogRecord)).matches("asciidoctor: INFO: .*/asciidoctor-maven-plugin/file.adoc: a message");
}