src/main/java/com/arpnetworking/logback/serialization/keyvalue/KeyValueSerializationHelper.java
public static Map<String, Object> createContext(
            final KeyValueEncoder encoder,
            final ILoggingEvent event,
            @Nullable final List<String> contextKeys,
            @Nullable final List<Object> contextValues) {
        final Map<String, Object> context = new LinkedHashMap<>();
        context.put("host", KeyValueSerializationHelper.HOST_CONVERTER.convert(event));
        context.put("processId", KeyValueSerializationHelper.PROCESS_CONVERTER.convert(event));
        context.put("threadId", KeyValueSerializationHelper.THREAD_CONVERTER.convert(event));
        if (contextKeys != null) {
            final int contextValuesLength = contextValues == null ? 0 : contextValues.size();
            for (int i = 0; i < contextKeys.size(); ++i) {
                final String key = contextKeys.get(i);
                final Object value = i < contextValuesLength ? contextValues.get(i) : null;
                context.put(
                        key,
                        value);
            }
        }
        return context;
    }
public static Map<String, Object> createContext(
            final KeyValueEncoder encoder,
            final ILoggingEvent event,
            @Nullable final List<String> contextKeys,
            @Nullable final List<Object> contextValues) {
        final Map<String, Object> context = new LinkedHashMap<>();
        context.put("host", KeyValueSerializationHelper.HOST_CONVERTER.convert(event));
        context.put("processId", KeyValueSerializationHelper.PROCESS_CONVERTER.convert(event));
        context.put("threadId", KeyValueSerializationHelper.THREAD_CONVERTER.convert(event));
        if (contextKeys != null) {
            final int contextValuesLength = contextValues == null ? 0 : contextValues.size();
            for (int i = 0; i < contextKeys.size(); ++i) {
                final String key = contextKeys.get(i);
                final Object value = i < contextValuesLength ? contextValues.get(i) : null;
                context.put(
                        key,
                        value);
            }
        }
        return context;
    }
public static Map < String , Object > createContext ( final KeyValueEncoder encoder , final ILoggingEvent event , @ Nullable final List < String > contextKeys , @ Nullable final List < Object > contextValues ) { final Map < String , Object > context = new LinkedHashMap <> ( ) ; context . put ( "host" , KeyValueSerializationHelper . HOST_CONVERTER . convert ( event ) ) ; context . put ( "processId" , KeyValueSerializationHelper . PROCESS_CONVERTER . convert ( event ) ) ; context . put ( "threadId" , KeyValueSerializationHelper . THREAD_CONVERTER . convert ( event ) ) ; if ( contextKeys != null ) { final int contextValuesLength = contextValues == null ? 0 : contextValues . size ( ) ; for ( int i = 0 ; i < contextKeys . size ( ) ; ++ i ) { final String key = contextKeys . get ( i ) ; final Object value = i < contextValuesLength ? contextValues . get ( i ) : null ; context . put ( key , value ) ; } } return context ; }
Create a context based on the <code>KeyValueEncoder</code> configuration.

@since 1.9.0

@param encoder The <code>KeyValueEncoder</code> instance.
@param event The <code>ILoggingEvent</code> instance.
@param contextKeys The additional user provided context keys.
@param contextValues The additional user provided context values matching the keys.
@return <code>Map</code> with event context.
Create a context based on the <code > KeyValueEncoder< / code > configuration .