@Override
    public byte[] encode(ILoggingEvent event) {
        final int initialCapacity = event.getThrowableProxy() == null ? DEFAULT_SIZE : DEFAULT_SIZE_WITH_THROWABLE;
        StringBuilder sb = new StringBuilder(initialCapacity);
        sb.append(OPEN_OBJ);

        if (withSequenceNumber) {
            appenderMemberWithLongValue(sb, SEQUENCE_NUMBER_ATTR_NAME, event.getSequenceNumber());
            sb.append(VALUE_SEPARATOR);
        }

        if (withTimestamp) {
            appenderMemberWithLongValue(sb, TIMESTAMP_ATTR_NAME, event.getTimeStamp());
            sb.append(VALUE_SEPARATOR);
        }

        if (withNanoseconds) {
            appenderMemberWithLongValue(sb, NANOSECONDS_ATTR_NAME, event.getNanoseconds());
            sb.append(VALUE_SEPARATOR);
        }

        if (withLevel) {
            String levelStr = event.getLevel() != null ? event.getLevel().levelStr : NULL_STR;
            appenderMember(sb, LEVEL_ATTR_NAME, levelStr);
            sb.append(VALUE_SEPARATOR);
        }

        if (withThreadName) {
            appenderMember(sb, THREAD_NAME_ATTR_NAME, jsonEscape(event.getThreadName()));
            sb.append(VALUE_SEPARATOR);
        }

        if (withLoggerName) {
            appenderMember(sb, LOGGER_ATTR_NAME, event.getLoggerName());
            sb.append(VALUE_SEPARATOR);
        }

        if (withContext) {
            appendLoggerContext(sb, event.getLoggerContextVO());
            sb.append(VALUE_SEPARATOR);
        }
        if (withMarkers)
            appendMarkers(sb, event);

        if (withMDC)
            appendMDC(sb, event);

        if (withKVPList)
            appendKeyValuePairs(sb, event);

        if (withMessage) {
            appenderMember(sb, MESSAGE_ATTR_NAME, jsonEscape(event.getMessage()));
            sb.append(VALUE_SEPARATOR);
        }

        if (withFormattedMessage) {
            appenderMember(sb, FORMATTED_MESSAGE_ATTR_NAME, jsonEscape(event.getFormattedMessage()));
            sb.append(VALUE_SEPARATOR);
        }

        if (withArguments)
            appendArgumentArray(sb, event);

        if (withThrowable)
            appendThrowableProxy(sb, THROWABLE_ATTR_NAME, event.getThrowableProxy());

        sb.append(CLOSE_OBJ);
        sb.append(CoreConstants.JSON_LINE_SEPARATOR);
        return sb.toString().getBytes(UTF_8_CHARSET);
    }
@Test
    void withMarkers() throws JsonProcessingException {
        LoggingEvent event = new LoggingEvent("x", logger, Level.WARN, "hello", null, null);
        event.addMarker(markerA);
        event.addMarker(markerB);

        byte[] resultBytes = jsonEncoder.encode(event);
        String resultString = new String(resultBytes, StandardCharsets.UTF_8);
        //System.out.println(resultString);

        JsonLoggingEvent resultEvent = stringToLoggingEventMapper.mapStringToLoggingEvent(resultString);
        compareEvents(event, resultEvent);
    }