Skip to content

Releases: Numichi/reactive-logger

v4.0.4

27 Nov 16:14
Compare
Choose a tag to compare
  • Upgrade Spring Boot from 2.7.5 to 2.7.6
  • Duplicate configuration annotation removed

v4.0.3

20 Nov 10:10
Compare
Choose a tag to compare
  • org.slf4j:slf4j-api dependeny upgrade from 2.0.3 to 2.0.4

v4.0.2

18 Nov 18:51
Compare
Choose a tag to compare
  • Dependencies upgrade
  • Change annotation: @Configuration to @AutoConfiguration

No other changes occurred.

v4.0.1

09 Oct 19:53
Compare
Choose a tag to compare
  • fix contextKey type in some place
  • result of the above fix, some methods conflicted together, so they were reorganized
  • added instances based handler

v4.0.0

09 Oct 10:21
Compare
Choose a tag to compare
  • Bug fixes
  • setting some methods to static

v4.0.0-RC0

07 Oct 17:07
Compare
Choose a tag to compare
v4.0.0-RC0 Pre-release
Pre-release
  • All v3.2
  • bug fixes
  • Spring support fix
    • application.yml or application.properties configuration for custom registries, similar resilience4j spring boot solution.
    • MDCHook can be added via Bean, which will activate it for logging.
  • old methods removed
  • MDC reader throws an exception if the context key does not exist
  • added snapshot methods, which give MDC and trigger hooks
  • MDC has ceased to be a MAP, from here MDC is an immutable data class
  • added operators support in MDC like mdc + mapOf("foo" to "bar") (for Kotlin). Simular in Java mdc.plus(Map.of("foo", "bar"))
    • not just for Map

v3.2.0-RC0

24 Sep 12:58
Compare
Choose a tag to compare
v3.2.0-RC0 Pre-release
Pre-release

v3.1.0

18 Sep 17:08
Compare
Choose a tag to compare

Blocking wrong configuration

There is an option in Coroutine with more context class configuration. Like: coroutineContext[CustomClass]. ReactorContext is used In Spring Reactive and it will work in unexpected ways with custom resolvers, so that's why the custom context resolver was removed.

Example - if you fill in all the fields

// Before
CoroutineLogger.getLogger("...", null, null) { Context.empty() }
CoroutineKLogger.getLogger("...", null, null) { Context.empty() }

// After
CoroutineLogger.getLogger("...", null, null)
CoroutineKLogger.getLogger("...", null, null)

Add new methods MDCContext.modifyContext

You can add map into modifyContext and merge it with the current MDC map.

.contextWrite { ctx -> MDCContext.modifyContext(ctx, mapOf("key" to "example")) }
.contextWrite { ctx -> MDCContext.modifyContext(ctx, "key", mapOf("key" to "example")) }

Support .doOnEach() method

In Java: <T> void logConsumer(BiConsumer<Logger, Signal<T>> consumer)

var logger = ReactiveLogger.getLogger(JavaClassExample.class); // and ReactiveKLogger

.doOnEach(logger.logConsumer((log, signal) -> {
    if (signal.getType() == SignalType.ON_NEXT) log.info(signal.get());
    if (signal.getType() == SignalType.ON_ERROR) {
        Optional.ofNullable(signal.getThrowable()).ifPresent(it -> {
            log.error(it.getMessage());
        });
    }
}))

In Kotlin: above and also fun <T> logSignal(signal: Signal<T>, fn: (Logger) -> Unit)

val logger = CoroutineLogger.getLogger({}) // and CoroutineKLogger

.doOnEach(reactiveLogger.logConsumer { log, signal ->
    if (signal.type == SignalType.ON_NEXT) log.info(signal.get())
    if (signal.type == SignalType.ON_ERROR) log.error(signal.throwable?.message)
})
// or
.doOnEach { signal ->
    if (s.isOnNext) logger.logSignal(signal) { it.info(s.get()) }
    if (s.isOnError) logger.logSignal(signal) { it.error(s.throwable?.message) }
}

v3.0.1

17 Sep 17:23
Compare
Choose a tag to compare

Easier to use for Java language. Not need INSTANCE when calling methods like in Kotlin. There are new methods in ReactiveLogger with one parameter without defaults because Java language can not understand like ... , param = 0): ....

Java Example:

// Before (can also be used after modification)
Configuration.INSTANCE.addGenericHook("test", "foo", 0, (String value, MDC mdc) -> Map.of("key", value));
Configuration.INSTANCE.setDefaultReactorContextMdcKey("custom");
var logger = ReactiveLogger.Companion.getLogger(JavaExample.class, null, null);
logger.info("message");

// After
Configuration.addGenericHook("test", "foo", (String value, MDC mdc) -> Map.of("key", value)); // order default value is 0
Configuration.setDefaultReactorContextMdcKey("custom");
var logger = ReactiveLogger.getLogger(JavaExample.class);
logger.info("message"); // result: Mono<ViewContext>

v3.0.0

16 Sep 16:22
Compare
Choose a tag to compare
release: 3.0.0