private void recursiveWrite()

in src/main/java/com/spotify/logging/logback/MillisecondPrecisionSyslogAppender.java [112:144]


  private void recursiveWrite(
      final OutputStream sw,
      final String stackTracePrefix,
      final IThrowableProxy tp,
      final int indent,
      final @Nullable String firstLinePrefix) {
    final StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
    try {
      handleThrowableFirstLine(sw, tp, stackTracePrefix, indent, firstLinePrefix);
      for (final StackTraceElementProxy step : stepArray) {
        final StringBuilder sb = new StringBuilder();
        sb.append(stackTracePrefix);
        addIndent(sb, indent);
        sb.append(step);
        sw.write(sb.toString().getBytes(StandardCharsets.UTF_8));
        sw.flush();
      }
    } catch (IOException e) {
      return;
    }

    final IThrowableProxy[] suppressed = tp.getSuppressed();
    if (suppressed != null) {
      for (final IThrowableProxy current : suppressed) {
        recursiveWrite(sw, stackTracePrefix, current, indent + 1, CoreConstants.SUPPRESSED);
      }
    }

    final IThrowableProxy cause = tp.getCause();
    if (cause != null) {
      recursiveWrite(sw, stackTracePrefix, cause, indent, CoreConstants.CAUSED_BY);
    }
  }