src/main/java/com/arpnetworking/logback/serialization/steno/StenoSerializationHelper.java
public static Map<String, Object> createContext(
            final StenoEncoder encoder,
            final ILoggingEvent event,
            final ObjectMapper objectMapper,
            @Nullable final List<String> contextKeys,
            @Nullable final List<Object> contextValues) {

        final Map<String, Object> context = new LinkedHashMap<>();
        if (encoder.isInjectContextHost()) {
            context.put("host", StenoSerializationHelper.HOST_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextProcess()) {
            context.put("processId", StenoSerializationHelper.PROCESS_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextThread()) {
            context.put("threadId", StenoSerializationHelper.THREAD_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextLogger()) {
            if (encoder.isCompressLoggerName()) {
                context.put("logger", StenoSerializationHelper.CONDENSED_LOGGER_CONVERTER.convert(event));
            } else {
                context.put("logger", StenoSerializationHelper.LOGGER_CONVERTER.convert(event));
            }
        }
        if (encoder.isInjectContextFile()) {
            context.put("file", StenoSerializationHelper.FILE_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextClass()) {
            context.put("class", StenoSerializationHelper.CLASS_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextMethod()) {
            context.put("method", StenoSerializationHelper.METHOD_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextLine()) {
            context.put("line", StenoSerializationHelper.LINE_CONVERTER.convert(event));
        }
        final Iterator<String> injectContextMdcIterator = encoder.iteratorForInjectContextMdc();
        while (injectContextMdcIterator.hasNext()) {
            final String key = injectContextMdcIterator.next();
            final String value = event.getMDCPropertyMap().get(key);
            context.put(key, value);
        }
        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 StenoEncoder encoder,
            final ILoggingEvent event,
            final ObjectMapper objectMapper,
            @Nullable final List<String> contextKeys,
            @Nullable final List<Object> contextValues) {

        final Map<String, Object> context = new LinkedHashMap<>();
        if (encoder.isInjectContextHost()) {
            context.put("host", StenoSerializationHelper.HOST_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextProcess()) {
            context.put("processId", StenoSerializationHelper.PROCESS_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextThread()) {
            context.put("threadId", StenoSerializationHelper.THREAD_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextLogger()) {
            if (encoder.isCompressLoggerName()) {
                context.put("logger", StenoSerializationHelper.CONDENSED_LOGGER_CONVERTER.convert(event));
            } else {
                context.put("logger", StenoSerializationHelper.LOGGER_CONVERTER.convert(event));
            }
        }
        if (encoder.isInjectContextFile()) {
            context.put("file", StenoSerializationHelper.FILE_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextClass()) {
            context.put("class", StenoSerializationHelper.CLASS_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextMethod()) {
            context.put("method", StenoSerializationHelper.METHOD_CONVERTER.convert(event));
        }
        if (encoder.isInjectContextLine()) {
            context.put("line", StenoSerializationHelper.LINE_CONVERTER.convert(event));
        }
        final Iterator<String> injectContextMdcIterator = encoder.iteratorForInjectContextMdc();
        while (injectContextMdcIterator.hasNext()) {
            final String key = injectContextMdcIterator.next();
            final String value = event.getMDCPropertyMap().get(key);
            context.put(key, value);
        }
        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 StenoEncoder encoder , final ILoggingEvent event , final ObjectMapper objectMapper , @ Nullable final List < String > contextKeys , @ Nullable final List < Object > contextValues ) { final Map < String , Object > context = new LinkedHashMap <> ( ) ; if ( encoder . isInjectContextHost ( ) ) { context . put ( "host" , StenoSerializationHelper . HOST_CONVERTER . convert ( event ) ) ; } if ( encoder . isInjectContextProcess ( ) ) { context . put ( "processId" , StenoSerializationHelper . PROCESS_CONVERTER . convert ( event ) ) ; } if ( encoder . isInjectContextThread ( ) ) { context . put ( "threadId" , StenoSerializationHelper . THREAD_CONVERTER . convert ( event ) ) ; } if ( encoder . isInjectContextLogger ( ) ) { if ( encoder . isCompressLoggerName ( ) ) { context . put ( "logger" , StenoSerializationHelper . CONDENSED_LOGGER_CONVERTER . convert ( event ) ) ; } else { context . put ( "logger" , StenoSerializationHelper . LOGGER_CONVERTER . convert ( event ) ) ; } } if ( encoder . isInjectContextFile ( ) ) { context . put ( "file" , StenoSerializationHelper . FILE_CONVERTER . convert ( event ) ) ; } if ( encoder . isInjectContextClass ( ) ) { context . put ( "class" , StenoSerializationHelper . CLASS_CONVERTER . convert ( event ) ) ; } if ( encoder . isInjectContextMethod ( ) ) { context . put ( "method" , StenoSerializationHelper . METHOD_CONVERTER . convert ( event ) ) ; } if ( encoder . isInjectContextLine ( ) ) { context . put ( "line" , StenoSerializationHelper . LINE_CONVERTER . convert ( event ) ) ; } final Iterator < String > injectContextMdcIterator = encoder . iteratorForInjectContextMdc ( ) ; while ( injectContextMdcIterator . hasNext ( ) ) { final String key = injectContextMdcIterator . next ( ) ; final String value = event . getMDCPropertyMap ( ) . get ( key ) ; context . put ( key , value ) ; } 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>StenoEncoder</code> configuration.

@since 1.7.0
@param encoder The <code>StenoEncoder</code> instance.
@param event The <code>ILoggingEvent</code> instance.
@param objectMapper <code>ObjectMapper</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 > StenoEncoder< / code > configuration .