code: private static void formatBadLogData(LogData data, StringBuilder out) {
      out.append("  original message: ");
      if (data.getTemplateContext() == null) {
        out.append(data.getLiteralArgument());
      } else {
        // We know that there's at least one argument to display here.
        out.append(data.getTemplateContext().getMessage());
        out.append("\n  original arguments:");
        for (Object arg : data.getArguments()) {
          out.append("\n    ").append(SimpleMessageFormatter.safeToString(arg));
        }
      }
      Metadata metadata = data.getMetadata();
      if (metadata.size() > 0) {
        out.append("\n  metadata:");
        for (int n = 0; n < metadata.size(); n++) {
          out.append("\n    ");
          out.append(metadata.getKey(n).getLabel()).append(": ").append(metadata.getValue(n));
        }
      }
      out.append("\n  level: ").append(data.getLevel());
      out.append("\n  timestamp (nanos): ").append(data.getTimestampNanos());
      out.append("\n  class: ").append(data.getLogSite().getClassName());
      out.append("\n  method: ").append(data.getLogSite().getMethodName());
      out.append("\n  line number: ").append(data.getLogSite().getLineNumber());
    }
docs: based on com.google.common.flogger.backend.system.AbstractLogRecord.safeAppend