From e7a036f6abac43da89235eb94ea7b842fb4c7abf Mon Sep 17 00:00:00 2001 From: Qingtian Wang Date: Sun, 24 Dec 2023 22:36:07 -0600 Subject: [PATCH] + elf4j-engine version bump --- pom.xml | 26 ++++++++++++++-- .../java/elf4j/engine/jpl/Elf4jLogger.java | 6 ++-- .../elf4j/engine/jpl/Elf4jLoggerFinder.java | 13 ++++---- .../elf4j/engine/jpl/Elf4jLoggerTest.java | 30 +++++++++++-------- 4 files changed, 50 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index b583468..d44ffb9 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ io.github.elf4j jpl-elf4j - 7.0.8 + 8.0.0 jar jpl-elf4j Native logging service provider implementation of ELF4J (Easy Logging Facade For Java) @@ -68,7 +68,7 @@ io.github.elf4j elf4j-engine - 13.0.5 + 15.0.0 org.junit.jupiter @@ -172,6 +172,28 @@ + + com.diffplug.spotless + spotless-maven-plugin + 2.41.1 + + + spotless-apply-id + process-sources + + apply + + + + + + + 2.39.0 + + + + + org.apache.maven.plugins maven-javadoc-plugin diff --git a/src/main/java/elf4j/engine/jpl/Elf4jLogger.java b/src/main/java/elf4j/engine/jpl/Elf4jLogger.java index 9f39947..551ddec 100644 --- a/src/main/java/elf4j/engine/jpl/Elf4jLogger.java +++ b/src/main/java/elf4j/engine/jpl/Elf4jLogger.java @@ -1,12 +1,11 @@ package elf4j.engine.jpl; import elf4j.engine.NativeLogger; -import lombok.Value; - import java.text.MessageFormat; import java.util.Objects; import java.util.ResourceBundle; import java.util.function.Supplier; +import lombok.Value; /** * @@ -99,7 +98,8 @@ private void service(Level level, ResourceBundle bundle, Throwable thrown, Strin } MessageFormat messageFormat = bundle == null ? new MessageFormat(format) : new MessageFormat(format, bundle.getLocale()); - delegateLogger.getLogService() + delegateLogger + .getLogService() .log(delegateLogger, SERVICE_INTERFACE_CLASS, thrown, messageFormat.format(params), null); } } diff --git a/src/main/java/elf4j/engine/jpl/Elf4jLoggerFinder.java b/src/main/java/elf4j/engine/jpl/Elf4jLoggerFinder.java index 7dee952..cfe49be 100644 --- a/src/main/java/elf4j/engine/jpl/Elf4jLoggerFinder.java +++ b/src/main/java/elf4j/engine/jpl/Elf4jLoggerFinder.java @@ -1,7 +1,6 @@ package elf4j.engine.jpl; -import elf4j.engine.NativeLoggerFactory; - +import elf4j.engine.NativeLogServiceProvider; import java.util.HashMap; import java.util.Map; @@ -10,22 +9,22 @@ */ public class Elf4jLoggerFinder extends System.LoggerFinder { private static final Class SERVICE_ACCESS_CLASS = System.class; - private final NativeLoggerFactory nativeLoggerFactory; + private final NativeLogServiceProvider nativeLogServiceProvider; private final Map elf4jLoggers = new HashMap<>(); /** * Default constructor required by {@link java.util.ServiceLoader} */ public Elf4jLoggerFinder() { - this(new NativeLoggerFactory(SERVICE_ACCESS_CLASS)); + this(new NativeLogServiceProvider(SERVICE_ACCESS_CLASS)); } - Elf4jLoggerFinder(NativeLoggerFactory nativeLoggerFactory) { - this.nativeLoggerFactory = nativeLoggerFactory; + Elf4jLoggerFinder(NativeLogServiceProvider nativeLogServiceProvider) { + this.nativeLogServiceProvider = nativeLogServiceProvider; } @Override public System.Logger getLogger(String name, Module module) { - return elf4jLoggers.computeIfAbsent(name, k -> new Elf4jLogger(k, nativeLoggerFactory.logger())); + return elf4jLoggers.computeIfAbsent(name, k -> new Elf4jLogger(k, nativeLogServiceProvider.logger())); } } diff --git a/src/test/java/elf4j/engine/jpl/Elf4jLoggerTest.java b/src/test/java/elf4j/engine/jpl/Elf4jLoggerTest.java index 46f8542..fb65ae6 100644 --- a/src/test/java/elf4j/engine/jpl/Elf4jLoggerTest.java +++ b/src/test/java/elf4j/engine/jpl/Elf4jLoggerTest.java @@ -1,10 +1,9 @@ package elf4j.engine.jpl; -import lombok.NonNull; -import org.junit.jupiter.api.Test; - import java.util.Enumeration; import java.util.ResourceBundle; +import lombok.NonNull; +import org.junit.jupiter.api.Test; class Elf4jLoggerTest { System.Logger logger = System.getLogger(Elf4jLoggerTest.class.getName()); @@ -15,16 +14,21 @@ void logs() { logger.log(System.Logger.Level.INFO, () -> "This message comes from a Supplier"); logger.log(System.Logger.Level.INFO, "Parameterized message with args {0} and {1}", "ONE", "TWO"); logger.log(System.Logger.Level.ERROR, "Houston, we have a problem!", new Exception("Houston exception")); - logger.log(System.Logger.Level.INFO, new ResourceBundle() { - @Override - protected Object handleGetObject(@NonNull String key) { - return key; - } + logger.log( + System.Logger.Level.INFO, + new ResourceBundle() { + @Override + protected Object handleGetObject(@NonNull String key) { + return key; + } - @Override - public Enumeration getKeys() { - throw new UnsupportedOperationException(); - } - }, "Localized message with args {0} and {1}", "FOO", "BAR"); + @Override + public @NonNull Enumeration getKeys() { + throw new UnsupportedOperationException(); + } + }, + "Localized message with args {0} and {1}", + "FOO", + "BAR"); } }