diff --git a/pom.xml b/pom.xml index dce6ff0..6c21861 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ io.github.elf4j slf4j-elf4j - 6.1.0 + 6.2.0 jar slf4j-elf4j SLF4J binding to use ELF4J native logging implementation @@ -67,13 +67,12 @@ org.slf4j slf4j-api - 2.0.12 + 2.0.13 io.github.elf4j elf4j-engine 15.2.0 - provided org.projectlombok @@ -163,7 +162,7 @@ - 2.40.0 + 2.43.0 true diff --git a/src/main/java/elf4j/engine/slf4/Elf4jLogger.java b/src/main/java/elf4j/engine/slf4/Elf4jLogger.java index 319f9d3..8f43ac0 100644 --- a/src/main/java/elf4j/engine/slf4/Elf4jLogger.java +++ b/src/main/java/elf4j/engine/slf4/Elf4jLogger.java @@ -28,13 +28,14 @@ import elf4j.Level; import elf4j.engine.NativeLogger; import java.util.EnumMap; +import lombok.NonNull; import org.slf4j.Logger; import org.slf4j.Marker; import org.slf4j.event.LoggingEvent; import org.slf4j.spi.DefaultLoggingEventBuilder; import org.slf4j.spi.LoggingEventAware; -/** */ +/** A SLF4J Logger implemented via the elf4j-engine */ public class Elf4jLogger implements Logger, LoggingEventAware { private static final Class LOGGING_SERVICE_CLASS_SLF4J_FLUENT_API = DefaultLoggingEventBuilder.class; private static final Class LOGGING_SERVICE_CLASS_SLF4J_LEGACY_API = Elf4jLogger.class; @@ -51,7 +52,11 @@ public class Elf4jLogger implements Logger, LoggingEventAware { private final NativeLogger nativeLogger; - /** @param nativeLogger wrapped elf4j-impl logger */ + /** + * Wraps a delegate of elf4j-engine Logger + * + * @param nativeLogger wrapped elf4j-impl logger + */ public Elf4jLogger(NativeLogger nativeLogger) { this.nativeLogger = nativeLogger; } @@ -366,7 +371,7 @@ public void error(Marker marker, String msg, Throwable t) { } @Override - public void log(LoggingEvent event) { + public void log(@NonNull LoggingEvent event) { service( nativeLogger.atLevel(translate(event.getLevel())), LOGGING_SERVICE_CLASS_SLF4J_FLUENT_API, diff --git a/src/main/java/elf4j/engine/slf4/Elf4jLoggerFactory.java b/src/main/java/elf4j/engine/slf4/Elf4jLoggerFactory.java index 79889e2..c0a005f 100644 --- a/src/main/java/elf4j/engine/slf4/Elf4jLoggerFactory.java +++ b/src/main/java/elf4j/engine/slf4/Elf4jLoggerFactory.java @@ -32,7 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** */ +/** Produces SLF4J Logger instances implemented via the elf4j-engine */ public class Elf4jLoggerFactory implements ILoggerFactory { private static final Class LOGGING_SERVICE_ACCESS_CLASS = LoggerFactory.class; private final NativeLogServiceProvider nativeLogServiceProvider; diff --git a/src/main/java/elf4j/engine/slf4/Elf4jServiceProvider.java b/src/main/java/elf4j/engine/slf4/Elf4jServiceProvider.java index df14c35..43b6227 100644 --- a/src/main/java/elf4j/engine/slf4/Elf4jServiceProvider.java +++ b/src/main/java/elf4j/engine/slf4/Elf4jServiceProvider.java @@ -27,18 +27,22 @@ import org.slf4j.ILoggerFactory; import org.slf4j.IMarkerFactory; +import org.slf4j.helpers.BasicMDCAdapter; import org.slf4j.helpers.BasicMarkerFactory; -import org.slf4j.helpers.NOPMDCAdapter; import org.slf4j.spi.MDCAdapter; import org.slf4j.spi.SLF4JServiceProvider; -/** */ +/** Provides SLF4J utils implemented via elf4j-engine */ public class Elf4jServiceProvider implements SLF4JServiceProvider { private static final String REQUESTED_API_VERSION = "2.0.99"; private ILoggerFactory loggerFactory; private IMarkerFactory markerFactory; private MDCAdapter mdcAdapter; + /** A default constructor is required by the JDK Service Loader framework */ + public Elf4jServiceProvider() {} + + @Override public ILoggerFactory getLoggerFactory() { return loggerFactory; } @@ -62,6 +66,6 @@ public String getRequestedApiVersion() { public void initialize() { loggerFactory = new Elf4jLoggerFactory(); markerFactory = new BasicMarkerFactory(); - mdcAdapter = new NOPMDCAdapter(); + mdcAdapter = new BasicMDCAdapter(); } }