public String serialize(
            final ILoggingEvent event,
            final String eventName,
            final String jsonData)
            throws Exception {

        final StringWriter jsonWriter = new StringWriter();
        final JsonGenerator jsonGenerator = _jsonFactory.createGenerator(jsonWriter);

        // Start wrapper
        StenoSerializationHelper.startStenoWrapper(event, eventName, jsonGenerator, _objectMapper);

        // Write event data
        jsonGenerator.writeFieldName("data");
        if (jsonData == null) {
            jsonGenerator.writeStartObject();
            jsonGenerator.writeEndObject();
        } else {
            jsonGenerator.writeRawValue(jsonData);
        }
        // TODO(vkoskela): Support writing null objects as-is via configuration [ISSUE-4]
        // e.g. "data":null -- although this is not supported by the current Steno specification

        // Output throwable
        StenoSerializationHelper.writeThrowable(event.getThrowableProxy(), jsonGenerator, _objectMapper);

        // End wrapper
        StenoSerializationHelper.endStenoWrapper(event, eventName, jsonGenerator, _objectMapper, _encoder);

        return jsonWriter.toString();
    }
public String serialize ( final ILoggingEvent event , final String eventName , final String jsonData ) throws Exception { final StringWriter jsonWriter = new StringWriter ( ) ; final JsonGenerator jsonGenerator = _jsonFactory . createGenerator ( jsonWriter ) ; StenoSerializationHelper . startStenoWrapper ( event , eventName , jsonGenerator , _objectMapper ) ; jsonGenerator . writeFieldName ( "data" ) ; if ( jsonData == null ) { jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeEndObject ( ) ; } else { jsonGenerator . writeRawValue ( jsonData ) ; } StenoSerializationHelper . writeThrowable ( event . getThrowableProxy ( ) , jsonGenerator , _objectMapper ) ; StenoSerializationHelper . endStenoWrapper ( event , eventName , jsonGenerator , _objectMapper , _encoder ) ; return jsonWriter . toString ( ) ; }
Serialize an event.

@param event The event.
@param eventName The event name.
@param jsonData The message data as serialized JSON.
@return Serialization of message as a <code>String</code>.
@throws Exception Serialization may throw any <code>Exception</code>.