protected Message buildLogMessage(final LogEvent logEvent,
                                      final Map<Object, Object> messagePayload) {
        val buildMessage = logEvent.getMarker() == null
            || !logEvent.getMarker().getName().equals(AsciiArtUtils.ASCII_ART_LOGGER_MARKER.getName());
        if (buildMessage) {
            val messageSanitizer = ApplicationContextProvider.getMessageSanitizer().orElseGet(MessageSanitizer::disabled);
            val formattedMessage = messageSanitizer.sanitize(logEvent.getMessage().getFormattedMessage());
            if (flattenMessage) {
                return new ObjectMessage(formattedMessage);
            }
            messagePayload.put("text", formattedMessage);
            if (logEvent.getMessage() instanceof final ObjectMessage objectMessage) {
                if (objectMessage.getParameter() instanceof final Map parameters) {
                    collectMessageParameters(messagePayload, messageSanitizer, parameters);
                } else {
                    try {
                        val parameters = MAPPER.convertValue(objectMessage.getParameter(), Map.class);
                        collectMessageParameters(messagePayload, messageSanitizer, parameters);
                    } catch (final Exception e) {
                        val parameters = Map.of("payload", objectMessage.getParameter().toString());
                        collectMessageParameters(messagePayload, messageSanitizer, parameters);
                    }
                }
            }
        }
        return new ObjectMessage(messagePayload);
    }
Build google cloud appender.

@param name           the name
@param projectId      the project id
@param flattenMessage the flatten message
@param appenderRef    the appender ref
@param filter         the filter
@param config         the config
@return the google cloud appender
support/cas-server-support-gcp-logging/src/main/java/org/apereo/cas/logging/GoogleCloudAppender.java