code: public ObjectNode convertToObjectNode(ILoggingEvent event) {
          final ObjectNode logLine = mapper.valueToTree(
                  event instanceof OtlType ? event : new ApplicationLogEvent(event));
          final Marker marker = event.getMarker();
  
          if (marker instanceof LogMetadata) {
              ObjectNode metadataNode = mapper.valueToTree(((LogMetadata) marker).getMetadata());
              logLine.setAll(metadataNode);
  
              for (Object o : ((LogMetadata) marker).getInlines()) {
                  metadataNode = mapper.valueToTree(o);
                  logLine.setAll(metadataNode);
              }
          }
          if (marker instanceof OtlMarker) {
              ObjectNode metadataNode = mapper.valueToTree(((OtlMarker) marker).getOtl());
              logLine.setAll(metadataNode);
          }
  
          for (Entry<String, String> e : event.getMDCPropertyMap().entrySet()) {
              if (!logLine.has(e.getKey())) {
                  logLine.put(e.getKey(), e.getValue());
              }
          }
  
          logLine.put("sequencenumber", LOG_SEQUENCE_NUMBER.incrementAndGet());
          return logLine;
      }
docs: Prepare a log event but don't append it, return it as an ObjectNode instead.
  @param the logging event to encode
  @return the JSON object version of the log event