LogUtil { public static MdcField newMdcField(final String name, @Nullable final String value) { return new ImmutableMdcField(name, value); } private  LogUtil(); static DiagnosticLoggingAdapter obtain(final Actor logSource); static void enhanceLogWithCorrelationId(final DiagnosticLoggingAdapter loggingAdapter,
            final WithDittoHeaders<?> withDittoHeaders, final MdcField... additionalMdcFields); static void enhanceLogWithCorrelationId(final DiagnosticLoggingAdapter loggingAdapter,
            final DittoHeaders dittoHeaders, final MdcField... additionalMdcFields); static void enhanceLogWithCorrelationId(final DiagnosticLoggingAdapter loggingAdapter,
            final Optional<String> correlationId, final MdcField... additionalMdcFields); static void enhanceLogWithCustomField(final MdcField mdcField); static void enhanceLogWithCorrelationId(final DiagnosticLoggingAdapter loggingAdapter,
            final CharSequence correlationId, final MdcField... additionalMdcFields); static void enhanceLogWithCustomField(final DiagnosticLoggingAdapter loggingAdapter,
            final String fieldName,
            @Nullable final CharSequence fieldValue,
            final MdcField... additionalMdcFields); static void enhanceLogWithCorrelationId(final WithDittoHeaders<?> withDittoHeaders); static void enhanceLogWithCorrelationId(final DittoHeaders dittoHeaders); static void enhanceLogWithCorrelationIdOrRandom(final WithDittoHeaders<?> withDittoHeaders); static void enhanceLogWithCorrelationIdOrRandom(final DittoHeaders dittoHeaders); static void enhanceLogWithCorrelationId(final Optional<String> correlationId); static void enhanceLogWithCorrelationId(@Nullable final CharSequence correlationId); static Optional<String> getCorrelationId(); static String getCorrelationId(final Supplier<String> defaultCorrelationIdSupplier); static void removeCorrelationId(); static void removeCustomField(final DiagnosticLoggingAdapter loggingAdapter, final String fieldName); static MdcField newMdcField(final String name, @Nullable final String value); static final String X_CORRELATION_ID; }
@Test public void newMdcField() { final String name = "any-thing"; final String value = "any-value"; final LogUtil.MdcField field = LogUtil.newMdcField(name, value); assertThat(field.getName()).isEqualTo(name); assertThat(field.getValue()).isEqualTo(value); }