diff --git a/pom.xml b/pom.xml
index 4ef7b8c..bdb71c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
io.github.elf4j
elf4j-engine
- 14.0.3
+ 15.0.0
jar
elf4j-engine
A stand-alone Java log engine implementing the ELF4J (Easy Logging Facade for Java) API
@@ -67,7 +67,7 @@
io.github.elf4j
elf4j
- 3.1.0
+ 4.0.0
io.github.q3769
diff --git a/src/main/java/elf4j/engine/NativeLoggerFactory.java b/src/main/java/elf4j/engine/NativeLogServiceProvider.java
similarity index 71%
rename from src/main/java/elf4j/engine/NativeLoggerFactory.java
rename to src/main/java/elf4j/engine/NativeLogServiceProvider.java
index 7a010f5..8316a48 100644
--- a/src/main/java/elf4j/engine/NativeLoggerFactory.java
+++ b/src/main/java/elf4j/engine/NativeLogServiceProvider.java
@@ -29,12 +29,12 @@
import elf4j.Level;
import elf4j.Logger;
-import elf4j.engine.service.EventingLogService;
-import elf4j.engine.service.LogService;
-import elf4j.engine.service.LogServiceManager;
+import elf4j.engine.service.EventingNativeLoggerService;
+import elf4j.engine.service.NativeLogServiceManager;
+import elf4j.engine.service.NativeLoggerService;
import elf4j.engine.service.configuration.LogServiceConfiguration;
import elf4j.engine.service.util.StackTraceUtils;
-import elf4j.spi.LoggerFactory;
+import elf4j.spi.LogServiceProvider;
import java.util.EnumSet;
import java.util.Map;
import java.util.Properties;
@@ -46,7 +46,7 @@
/**
*
*/
-public class NativeLoggerFactory implements LoggerFactory, LogServiceManager.Refreshable {
+public class NativeLogServiceProvider implements LogServiceProvider, NativeLogServiceManager.Refreshable {
private static final Level DEFAULT_LOGGER_SEVERITY_LEVEL = Level.INFO;
/**
* Made injectable for extensions other than this native ELF4J implementation
@@ -69,12 +69,12 @@ public class NativeLoggerFactory implements LoggerFactory, LogServiceManager.Ref
private final Class> serviceAccessClass;
@NonNull
- private final LogServiceFactory logServiceFactory;
+ private final NativeLogServiceProvider.NativeLoggerServiceFactory nativeLoggerServiceFactory;
/**
* Default constructor required by {@link java.util.ServiceLoader}
*/
- public NativeLoggerFactory() {
+ public NativeLogServiceProvider() {
this(Logger.class);
}
@@ -82,18 +82,18 @@ public NativeLoggerFactory() {
* @param serviceAccessClass the class or interface that the API client application calls first to a logger
* instance
*/
- public NativeLoggerFactory(@NonNull Class> serviceAccessClass) {
- this(DEFAULT_LOGGER_SEVERITY_LEVEL, serviceAccessClass, new ConfiguredLogServiceFactory());
+ public NativeLogServiceProvider(@NonNull Class> serviceAccessClass) {
+ this(DEFAULT_LOGGER_SEVERITY_LEVEL, serviceAccessClass, new ConfiguredNativeLoggerServiceFactory());
}
- NativeLoggerFactory(
+ NativeLogServiceProvider(
@NonNull Level defaultLoggerLevel,
@NonNull Class> serviceAccessClass,
- @NonNull LogServiceFactory logServiceFactory) {
+ @NonNull NativeLogServiceProvider.NativeLoggerServiceFactory nativeLoggerServiceFactory) {
this.defaultLoggerLevel = defaultLoggerLevel;
this.serviceAccessClass = serviceAccessClass;
- this.logServiceFactory = logServiceFactory;
- LogServiceManager.INSTANCE.register(this);
+ this.nativeLoggerServiceFactory = nativeLoggerServiceFactory;
+ NativeLogServiceManager.INSTANCE.register(this);
}
/**
@@ -110,51 +110,51 @@ public NativeLogger logger() {
@Override
public void refresh(@Nullable Properties properties) {
- logServiceFactory.reset(properties);
+ nativeLoggerServiceFactory.reset(properties);
}
@Override
public void refresh() {
- logServiceFactory.reload();
+ nativeLoggerServiceFactory.reload();
}
@NonNull
- LogService getLogService() {
- return logServiceFactory.getLogService();
+ NativeLoggerService getLogService() {
+ return nativeLoggerServiceFactory.getLogService();
}
NativeLogger getLogger(Level level, String declaringClassName) {
return nativeLoggers.get(level).computeIfAbsent(declaringClassName, k -> new NativeLogger(k, level, this));
}
- interface LogServiceFactory {
- LogService getLogService();
+ interface NativeLoggerServiceFactory {
+ NativeLoggerService getLogService();
void reload();
void reset(Properties properties);
}
- static class ConfiguredLogServiceFactory implements LogServiceFactory {
- private LogService logService;
+ static class ConfiguredNativeLoggerServiceFactory implements NativeLoggerServiceFactory {
+ private NativeLoggerService nativeLoggerService;
- private ConfiguredLogServiceFactory() {
- logService = new EventingLogService(LogServiceConfiguration.byLoading());
+ private ConfiguredNativeLoggerServiceFactory() {
+ nativeLoggerService = new EventingNativeLoggerService(LogServiceConfiguration.byLoading());
}
@Override
- public LogService getLogService() {
- return logService;
+ public NativeLoggerService getLogService() {
+ return nativeLoggerService;
}
@Override
public void reload() {
- logService = new EventingLogService(LogServiceConfiguration.byLoading());
+ nativeLoggerService = new EventingNativeLoggerService(LogServiceConfiguration.byLoading());
}
@Override
public void reset(Properties properties) {
- logService = new EventingLogService(LogServiceConfiguration.bySetting(properties));
+ nativeLoggerService = new EventingNativeLoggerService(LogServiceConfiguration.bySetting(properties));
}
}
}
diff --git a/src/main/java/elf4j/engine/NativeLogger.java b/src/main/java/elf4j/engine/NativeLogger.java
index c672c3a..b66a58e 100644
--- a/src/main/java/elf4j/engine/NativeLogger.java
+++ b/src/main/java/elf4j/engine/NativeLogger.java
@@ -27,7 +27,7 @@
import elf4j.Level;
import elf4j.Logger;
-import elf4j.engine.service.LogService;
+import elf4j.engine.service.NativeLoggerService;
import javax.annotation.concurrent.ThreadSafe;
import lombok.NonNull;
@@ -56,28 +56,28 @@ public class NativeLogger implements Logger {
private final @NonNull String declaringClassName;
private final @NonNull Level level;
- private final @NonNull NativeLoggerFactory nativeLoggerFactory;
+ private final @NonNull NativeLogServiceProvider nativeLogServiceProvider;
/**
- * Constructor only meant to be used by {@link NativeLoggerFactory} and this class itself
+ * Constructor only meant to be used by {@link NativeLogServiceProvider} and this class itself
*
* @param declaringClassName name of the declaring class that requested this instance via the
* {@link Logger#instance()} method
* @param level severity level of this logger instance
- * @param nativeLoggerFactory log service access point from this instance, not reloadable
+ * @param nativeLogServiceProvider log service access point from this instance, not reloadable
*/
public NativeLogger(
@NonNull String declaringClassName,
@NonNull Level level,
- @NonNull NativeLoggerFactory nativeLoggerFactory) {
+ @NonNull NativeLogServiceProvider nativeLogServiceProvider) {
this.declaringClassName = declaringClassName;
this.level = level;
- this.nativeLoggerFactory = nativeLoggerFactory;
+ this.nativeLogServiceProvider = nativeLogServiceProvider;
}
@Override
public NativeLogger atLevel(Level level) {
- return this.level == level ? this : this.nativeLoggerFactory.getLogger(level, this.declaringClassName);
+ return this.level == level ? this : this.nativeLogServiceProvider.getLogger(level, this.declaringClassName);
}
@Override
@@ -118,8 +118,8 @@ public void log(Throwable throwable, String message, Object... arguments) {
/**
* @return directly callable log service, useful for other logging frameworks to use this engine
*/
- public LogService getLogService() {
- return this.nativeLoggerFactory.getLogService();
+ public NativeLoggerService getLogService() {
+ return this.nativeLogServiceProvider.getLogService();
}
/**
diff --git a/src/main/java/elf4j/engine/service/EventingLogService.java b/src/main/java/elf4j/engine/service/EventingNativeLoggerService.java
similarity index 95%
rename from src/main/java/elf4j/engine/service/EventingLogService.java
rename to src/main/java/elf4j/engine/service/EventingNativeLoggerService.java
index db5f7b3..9f48821 100644
--- a/src/main/java/elf4j/engine/service/EventingLogService.java
+++ b/src/main/java/elf4j/engine/service/EventingNativeLoggerService.java
@@ -40,13 +40,13 @@
/**
* converts a log request into an event for async processing
*/
-public class EventingLogService implements LogService {
+public class EventingNativeLoggerService implements NativeLoggerService {
private final boolean noop;
private final LogWriter logWriter;
private final LoggerOutputLevelThreshold loggerOutputLevelThreshold;
private final Map loggerEnabled = new ConcurrentHashMap<>();
- public EventingLogService(@NonNull LogServiceConfiguration logServiceConfiguration) {
+ public EventingNativeLoggerService(@NonNull LogServiceConfiguration logServiceConfiguration) {
if (logServiceConfiguration.isAbsent() || logServiceConfiguration.isTrue("noop")) {
noop = true;
IeLogger.WARN.log("No-op per configuration {}", logServiceConfiguration);
diff --git a/src/main/java/elf4j/engine/service/LogServiceManager.java b/src/main/java/elf4j/engine/service/NativeLogServiceManager.java
similarity index 99%
rename from src/main/java/elf4j/engine/service/LogServiceManager.java
rename to src/main/java/elf4j/engine/service/NativeLogServiceManager.java
index 57045d7..2dfe739 100644
--- a/src/main/java/elf4j/engine/service/LogServiceManager.java
+++ b/src/main/java/elf4j/engine/service/NativeLogServiceManager.java
@@ -39,7 +39,7 @@
*
*/
@ToString
-public enum LogServiceManager {
+public enum NativeLogServiceManager {
/**
*
*/
diff --git a/src/main/java/elf4j/engine/service/LogService.java b/src/main/java/elf4j/engine/service/NativeLoggerService.java
similarity index 97%
rename from src/main/java/elf4j/engine/service/LogService.java
rename to src/main/java/elf4j/engine/service/NativeLoggerService.java
index 5be41e4..ce1a027 100644
--- a/src/main/java/elf4j/engine/service/LogService.java
+++ b/src/main/java/elf4j/engine/service/NativeLoggerService.java
@@ -30,7 +30,7 @@
/**
*
*/
-public interface LogService extends PerformanceSensitive {
+public interface NativeLoggerService extends PerformanceSensitive {
/**
* @param nativeLogger to check for enablement
* @return true if the logger's level is at or above configured threshold
diff --git a/src/main/java/elf4j/engine/service/util/Elf4jPostTestProcessor.java b/src/main/java/elf4j/engine/service/util/Elf4jPostTestProcessor.java
index 1f30795..0f5e547 100644
--- a/src/main/java/elf4j/engine/service/util/Elf4jPostTestProcessor.java
+++ b/src/main/java/elf4j/engine/service/util/Elf4jPostTestProcessor.java
@@ -25,7 +25,7 @@
package elf4j.engine.service.util;
-import elf4j.engine.service.LogServiceManager;
+import elf4j.engine.service.NativeLogServiceManager;
import elf4j.util.IeLogger;
import org.junit.platform.launcher.TestExecutionListener;
import org.junit.platform.launcher.TestPlan;
@@ -38,6 +38,6 @@ public class Elf4jPostTestProcessor implements TestExecutionListener {
@Override
public void testPlanExecutionFinished(TestPlan testPlan) {
IeLogger.INFO.log("Shutting down elf4j service after finishing {}", testPlan);
- LogServiceManager.INSTANCE.shutdown();
+ NativeLogServiceManager.INSTANCE.shutdown();
}
}
diff --git a/src/main/java/elf4j/engine/service/writer/ConseqWriterGroup.java b/src/main/java/elf4j/engine/service/writer/ConseqWriterGroup.java
index 61e9819..606faaa 100644
--- a/src/main/java/elf4j/engine/service/writer/ConseqWriterGroup.java
+++ b/src/main/java/elf4j/engine/service/writer/ConseqWriterGroup.java
@@ -28,7 +28,7 @@
import conseq4j.execute.ConseqExecutor;
import elf4j.Level;
import elf4j.engine.service.LogEvent;
-import elf4j.engine.service.LogServiceManager;
+import elf4j.engine.service.NativeLogServiceManager;
import elf4j.engine.service.configuration.LogServiceConfiguration;
import elf4j.util.IeLogger;
import java.lang.reflect.InvocationTargetException;
@@ -44,7 +44,7 @@
* order; meanwhile, logs from the same caller thread will arrive sequentially in the same order as they are called in
* the original thread.
*/
-public class ConseqWriterGroup implements LogWriter, LogServiceManager.Stoppable {
+public class ConseqWriterGroup implements LogWriter, NativeLogServiceManager.Stoppable {
private static final int DEFAULT_CONCURRENCY = Runtime.getRuntime().availableProcessors();
private final List writers;
private final ConseqExecutor conseqExecutor;
@@ -57,7 +57,7 @@ private ConseqWriterGroup(@NonNull List writers, ConseqExecutor conse
this.writers = writers;
this.conseqExecutor = conseqExecutor;
IeLogger.INFO.log("{} service writer(s) in {}", writers.size(), this);
- LogServiceManager.INSTANCE.register(this);
+ NativeLogServiceManager.INSTANCE.register(this);
}
/**
diff --git a/src/test/java/elf4j/engine/Main.java b/src/test/java/elf4j/engine/Main.java
index 2241234..9b04cf2 100644
--- a/src/test/java/elf4j/engine/Main.java
+++ b/src/test/java/elf4j/engine/Main.java
@@ -26,7 +26,7 @@
package elf4j.engine;
import elf4j.Logger;
-import elf4j.engine.service.LogServiceManager;
+import elf4j.engine.service.NativeLogServiceManager;
import java.util.function.Supplier;
public class Main {
@@ -54,6 +54,6 @@ public static void main(String[] args) {
.atTrace()
.atDebug()
.log("Not a practical example but now the severity level is DEBUG");
- LogServiceManager.INSTANCE.shutdown();
+ NativeLogServiceManager.INSTANCE.shutdown();
}
}
diff --git a/src/test/java/elf4j/engine/NativeLoggerFactoryTest.java b/src/test/java/elf4j/engine/NativeLoggerServiceProviderTest.java
similarity index 59%
rename from src/test/java/elf4j/engine/NativeLoggerFactoryTest.java
rename to src/test/java/elf4j/engine/NativeLoggerServiceProviderTest.java
index 0f1a8c8..8bde0f8 100644
--- a/src/test/java/elf4j/engine/NativeLoggerFactoryTest.java
+++ b/src/test/java/elf4j/engine/NativeLoggerServiceProviderTest.java
@@ -30,8 +30,8 @@
import static org.mockito.Mockito.mock;
import elf4j.Level;
-import elf4j.engine.service.LogService;
-import elf4j.engine.service.LogServiceManager;
+import elf4j.engine.service.NativeLogServiceManager;
+import elf4j.engine.service.NativeLoggerService;
import java.util.Properties;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
@@ -41,22 +41,22 @@
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
-class NativeLoggerFactoryTest {
+class NativeLoggerServiceProviderTest {
@Nested
class customizedFactory {
@Mock
- LogService logService;
+ NativeLoggerService nativeLoggerService;
@Mock
- NativeLoggerFactory.LogServiceFactory logServiceFactory;
+ NativeLogServiceProvider.NativeLoggerServiceFactory nativeLoggerServiceFactory;
- NativeLoggerFactory sut;
+ NativeLogServiceProvider sut;
@BeforeEach
void beforeEach() {
- sut = new NativeLoggerFactory(Level.ERROR, NativeLoggerFactory.class, logServiceFactory);
- LogServiceManager.INSTANCE.deregister(sut);
+ sut = new NativeLogServiceProvider(Level.ERROR, NativeLogServiceProvider.class, nativeLoggerServiceFactory);
+ NativeLogServiceManager.INSTANCE.deregister(sut);
}
@Test
@@ -71,66 +71,68 @@ void name() {
@Test
void service() {
- given(logServiceFactory.getLogService()).willReturn(logService);
+ given(nativeLoggerServiceFactory.getLogService()).willReturn(nativeLoggerService);
- assertSame(logService, sut.logger().getLogService());
+ assertSame(nativeLoggerService, sut.logger().getLogService());
}
@Nested
class refresh {
- NativeLoggerFactory sut;
+ NativeLogServiceProvider sut;
@Mock
- LogService logService;
+ NativeLoggerService nativeLoggerService;
@BeforeEach
void beforeEach() {
- sut = new NativeLoggerFactory(
- Level.ERROR, NativeLoggerFactory.class, new MockLogServiceFactory(logService));
- LogServiceManager.INSTANCE.deregister(sut);
+ sut = new NativeLogServiceProvider(
+ Level.ERROR,
+ NativeLogServiceProvider.class,
+ new MockNativeLoggerServiceFactory(nativeLoggerService));
+ NativeLogServiceManager.INSTANCE.deregister(sut);
}
@Test
void whenRefreshedBySetting() {
Properties properties = new Properties();
NativeLogger nativeLogger = sut.logger();
- LogService logService = nativeLogger.getLogService();
+ NativeLoggerService nativeLoggerService = nativeLogger.getLogService();
sut.refresh(properties);
- assertNotSame(nativeLogger.getLogService(), logService);
+ assertNotSame(nativeLogger.getLogService(), nativeLoggerService);
}
@Test
void whenRefreshedByLoading() {
NativeLogger nativeLogger = sut.logger();
- LogService logService = nativeLogger.getLogService();
+ NativeLoggerService nativeLoggerService = nativeLogger.getLogService();
sut.refresh();
- assertNotSame(nativeLogger.getLogService(), logService);
+ assertNotSame(nativeLogger.getLogService(), nativeLoggerService);
}
- class MockLogServiceFactory implements NativeLoggerFactory.LogServiceFactory {
- LogService logService;
+ class MockNativeLoggerServiceFactory implements NativeLogServiceProvider.NativeLoggerServiceFactory {
+ NativeLoggerService nativeLoggerService;
- private MockLogServiceFactory(LogService logService) {
- this.logService = logService;
+ private MockNativeLoggerServiceFactory(NativeLoggerService nativeLoggerService) {
+ this.nativeLoggerService = nativeLoggerService;
}
@Override
- public LogService getLogService() {
- return logService;
+ public NativeLoggerService getLogService() {
+ return nativeLoggerService;
}
@Override
public void reload() {
- logService = mock(LogService.class);
+ nativeLoggerService = mock(NativeLoggerService.class);
}
@Override
public void reset(Properties properties) {
- logService = mock(LogService.class);
+ nativeLoggerService = mock(NativeLoggerService.class);
}
}
}
diff --git a/src/test/java/elf4j/engine/NativeLoggerTest.java b/src/test/java/elf4j/engine/NativeLoggerTest.java
index dd49b93..336909f 100644
--- a/src/test/java/elf4j/engine/NativeLoggerTest.java
+++ b/src/test/java/elf4j/engine/NativeLoggerTest.java
@@ -35,7 +35,7 @@
import static org.mockito.Mockito.mock;
import elf4j.Logger;
-import elf4j.engine.service.LogService;
+import elf4j.engine.service.NativeLoggerService;
import java.util.function.Supplier;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
@@ -82,24 +82,24 @@ class isEnabled {
@Test
void delegateToService() {
- NativeLoggerFactory nativeLoggerFactory = mock(NativeLoggerFactory.class);
- LogService logService = mock(LogService.class);
- given(nativeLoggerFactory.getLogService()).willReturn(logService);
- NativeLogger sut = new NativeLogger(this.getClass().getName(), INFO, nativeLoggerFactory);
+ NativeLogServiceProvider nativeLogServiceProvider = mock(NativeLogServiceProvider.class);
+ NativeLoggerService nativeLoggerService = mock(NativeLoggerService.class);
+ given(nativeLogServiceProvider.getLogService()).willReturn(nativeLoggerService);
+ NativeLogger sut = new NativeLogger(this.getClass().getName(), INFO, nativeLogServiceProvider);
sut.isEnabled();
- then(logService).should().isEnabled(sut);
+ then(nativeLoggerService).should().isEnabled(sut);
}
}
@Nested
class logDelegateToService {
@Mock
- LogService logService;
+ NativeLoggerService nativeLoggerService;
@Mock
- NativeLoggerFactory nativeLoggerFactory;
+ NativeLogServiceProvider nativeLogServiceProvider;
NativeLogger sut;
String plainTextMessage = "plainTextMessage";
@@ -109,22 +109,24 @@ class logDelegateToService {
@BeforeEach
void beforeEach() {
- given(nativeLoggerFactory.getLogService()).willReturn(logService);
- sut = new NativeLogger(NativeLoggerTest.class.getName(), INFO, nativeLoggerFactory);
+ given(nativeLogServiceProvider.getLogService()).willReturn(nativeLoggerService);
+ sut = new NativeLogger(NativeLoggerTest.class.getName(), INFO, nativeLogServiceProvider);
}
@Test
void exception() {
sut.log(exception);
- then(logService).should().log(same(sut), same(NativeLogger.class), same(exception), isNull(), isNull());
+ then(nativeLoggerService)
+ .should()
+ .log(same(sut), same(NativeLogger.class), same(exception), isNull(), isNull());
}
@Test
void exceptionWithMessage() {
sut.log(exception, plainTextMessage);
- then(logService)
+ then(nativeLoggerService)
.should()
.log(same(sut), same(NativeLogger.class), same(exception), same(plainTextMessage), isNull());
}
@@ -133,7 +135,7 @@ void exceptionWithMessage() {
void exceptionWithMessageAndArgs() {
sut.log(exception, textMessageWithArgHolders, args);
- then(logService)
+ then(nativeLoggerService)
.should()
.log(
same(sut),
@@ -147,7 +149,7 @@ void exceptionWithMessageAndArgs() {
void messageWithArguments() {
sut.log(textMessageWithArgHolders, args);
- then(logService)
+ then(nativeLoggerService)
.should()
.log(same(sut), same(NativeLogger.class), isNull(), same(textMessageWithArgHolders), same(args));
}
@@ -156,7 +158,7 @@ void messageWithArguments() {
void plainText() {
sut.log(plainTextMessage);
- then(logService)
+ then(nativeLoggerService)
.should()
.log(same(sut), same(NativeLogger.class), isNull(), same(plainTextMessage), isNull());
}
diff --git a/src/test/java/elf4j/engine/service/EventingLogServiceTest.java b/src/test/java/elf4j/engine/service/EventingNativeLoggerServiceTest.java
similarity index 86%
rename from src/test/java/elf4j/engine/service/EventingLogServiceTest.java
rename to src/test/java/elf4j/engine/service/EventingNativeLoggerServiceTest.java
index 87fc313..4eb8b38 100644
--- a/src/test/java/elf4j/engine/service/EventingLogServiceTest.java
+++ b/src/test/java/elf4j/engine/service/EventingNativeLoggerServiceTest.java
@@ -45,17 +45,18 @@
import org.springframework.test.util.ReflectionTestUtils;
@ExtendWith(MockitoExtension.class)
-class EventingLogServiceTest {
+class EventingNativeLoggerServiceTest {
@AfterAll
static void afterAll() {
- LogServiceManager.INSTANCE.refresh();
+ NativeLogServiceManager.INSTANCE.refresh();
}
@Nested
class isEnabled {
@Test
void whenInvokingLog() {
- EventingLogService logService = spy(new EventingLogService(LogServiceConfiguration.bySetting(null)));
+ EventingNativeLoggerService logService =
+ spy(new EventingNativeLoggerService(LogServiceConfiguration.bySetting(null)));
NativeLogger stubLogger = mock(NativeLogger.class);
logService.log(stubLogger, this.getClass(), null, null, null);
@@ -69,21 +70,23 @@ class log {
@Test
void callWriter() {
- LogService logService = new EventingLogService(LogServiceConfiguration.bySetting(new Properties()));
+ NativeLoggerService nativeLoggerService =
+ new EventingNativeLoggerService(LogServiceConfiguration.bySetting(new Properties()));
LogWriter mockLogWriter = mock(LogWriter.class);
- ReflectionTestUtils.setField(logService, "logWriter", mockLogWriter);
+ ReflectionTestUtils.setField(nativeLoggerService, "logWriter", mockLogWriter);
NativeLogger stubLogger = mock(NativeLogger.class);
given(mockLogWriter.getThresholdOutputLevel()).willReturn(Level.INFO);
given(stubLogger.getLevel()).willReturn(Level.INFO);
- logService.log(stubLogger, this.getClass(), null, null, null);
+ nativeLoggerService.log(stubLogger, this.getClass(), null, null, null);
then(mockLogWriter).should().write(any(LogEvent.class));
}
@Test
void whenCallerDetailRequired() {
- LogService sut = new EventingLogService(LogServiceConfiguration.bySetting(new Properties()));
+ NativeLoggerService sut =
+ new EventingNativeLoggerService(LogServiceConfiguration.bySetting(new Properties()));
NativeLogger nativeLogger = mock(NativeLogger.class);
LogWriter logWriter = mock(LogWriter.class);
ReflectionTestUtils.setField(sut, "logWriter", logWriter);
@@ -107,7 +110,8 @@ void whenCallerDetailRequired() {
@Test
void whenCallerDetailNotRequired() {
- LogService sut = new EventingLogService(LogServiceConfiguration.bySetting(new Properties()));
+ NativeLoggerService sut =
+ new EventingNativeLoggerService(LogServiceConfiguration.bySetting(new Properties()));
NativeLogger nativeLogger = mock(NativeLogger.class);
LogWriter logWriter = mock(LogWriter.class);
ReflectionTestUtils.setField(sut, "logWriter", logWriter);
@@ -131,7 +135,8 @@ void whenCallerDetailNotRequired() {
@Test
void onlyLogWhenEnabled() {
- LogService sut = new EventingLogService(LogServiceConfiguration.bySetting(new Properties()));
+ NativeLoggerService sut =
+ new EventingNativeLoggerService(LogServiceConfiguration.bySetting(new Properties()));
NativeLogger nativeLogger = mock(NativeLogger.class);
LogWriter logWriter = mock(LogWriter.class);
ReflectionTestUtils.setField(sut, "logWriter", logWriter);
diff --git a/src/test/java/elf4j/engine/service/LogServiceManagerTest.java b/src/test/java/elf4j/engine/service/NativeLoggerServiceManagerTest.java
similarity index 88%
rename from src/test/java/elf4j/engine/service/LogServiceManagerTest.java
rename to src/test/java/elf4j/engine/service/NativeLoggerServiceManagerTest.java
index ca443c8..e1c400b 100644
--- a/src/test/java/elf4j/engine/service/LogServiceManagerTest.java
+++ b/src/test/java/elf4j/engine/service/NativeLoggerServiceManagerTest.java
@@ -10,11 +10,11 @@
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
-class LogServiceManagerTest {
+class NativeLoggerServiceManagerTest {
@AfterAll
static void cleanUp() {
- LogServiceManager.INSTANCE.refresh();
+ NativeLogServiceManager.INSTANCE.refresh();
}
@Nested
@@ -24,7 +24,7 @@ void whenLoggingAfterShutdown() {
elf4j.Logger logger = Logger.instance();
logger.log("before shutdown");
- LogServiceManager.INSTANCE.shutdown();
+ NativeLogServiceManager.INSTANCE.shutdown();
assertThrows(RejectedExecutionException.class, () -> logger.log("after shutdown"));
}
@@ -50,7 +50,7 @@ void whenForcingToNoop() {
Logger logger = Logger.instance();
logger.log("before noop set true, this is showing up in system console");
- LogServiceManager.INSTANCE.refresh(null);
+ NativeLogServiceManager.INSTANCE.refresh(null);
logger.log("after noop set true, this is not showing in system console");
}
@@ -62,7 +62,7 @@ void whenSetWithDifferentPropertiesThanLoaded() {
"before refresh, {} is to print with withLoadedProperties properties configuration",
withLoadedProperties);
- LogServiceManager.INSTANCE.refresh(new Properties());
+ NativeLogServiceManager.INSTANCE.refresh(new Properties());
Logger withSetProperties = Logger.instance();
assertSame(withLoadedProperties, withSetProperties);
diff --git a/src/test/java/elf4j/engine/service/pattern/JsonElementTest.java b/src/test/java/elf4j/engine/service/pattern/JsonElementTest.java
index 8d76a37..4ffac27 100644
--- a/src/test/java/elf4j/engine/service/pattern/JsonElementTest.java
+++ b/src/test/java/elf4j/engine/service/pattern/JsonElementTest.java
@@ -29,8 +29,8 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import elf4j.Level;
+import elf4j.engine.NativeLogServiceProvider;
import elf4j.engine.NativeLogger;
-import elf4j.engine.NativeLoggerFactory;
import elf4j.engine.service.LogEvent;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
@@ -42,7 +42,7 @@
@ExtendWith(MockitoExtension.class)
class JsonElementTest {
@Mock
- NativeLoggerFactory mockNativeLoggerFactory;
+ NativeLogServiceProvider mockNativeLogServiceProvider;
LogEvent mockLogEvent;
String mockMessage = "testLogMessage {}";
@@ -50,7 +50,7 @@ class JsonElementTest {
@BeforeEach
void beforeEach() {
mockLogEvent = LogEvent.builder()
- .nativeLogger(new NativeLogger("testLoggerName", Level.ERROR, mockNativeLoggerFactory))
+ .nativeLogger(new NativeLogger("testLoggerName", Level.ERROR, mockNativeLogServiceProvider))
.callerThread(new LogEvent.ThreadValue(
Thread.currentThread().getName(), Thread.currentThread().getId()))
.callerFrame(LogEvent.StackFrameValue.from(
diff --git a/src/test/java/elf4j/engine/service/pattern/MessageAndExceptionPatternTest.java b/src/test/java/elf4j/engine/service/pattern/MessageAndExceptionPatternTest.java
index 1c67031..f2596a6 100644
--- a/src/test/java/elf4j/engine/service/pattern/MessageAndExceptionPatternTest.java
+++ b/src/test/java/elf4j/engine/service/pattern/MessageAndExceptionPatternTest.java
@@ -28,8 +28,8 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import elf4j.Level;
+import elf4j.engine.NativeLogServiceProvider;
import elf4j.engine.NativeLogger;
-import elf4j.engine.NativeLoggerFactory;
import elf4j.engine.service.LogEvent;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
@@ -41,7 +41,7 @@
@ExtendWith(MockitoExtension.class)
class MessageAndExceptionPatternTest {
@Mock
- NativeLoggerFactory mockNativeLoggerFactory;
+ NativeLogServiceProvider mockNativeLogServiceProvider;
LogEvent mockLogEvent;
String mockMessage = "testLogMessage {}";
@@ -51,7 +51,7 @@ class MessageAndExceptionPatternTest {
@BeforeEach
void beforeEach() {
mockLogEvent = LogEvent.builder()
- .nativeLogger(new NativeLogger("testLoggerName", Level.ERROR, mockNativeLoggerFactory))
+ .nativeLogger(new NativeLogger("testLoggerName", Level.ERROR, mockNativeLogServiceProvider))
.callerThread(new LogEvent.ThreadValue(
Thread.currentThread().getName(), Thread.currentThread().getId()))
.callerFrame(LogEvent.StackFrameValue.from(
diff --git a/src/test/resources/META-INF/services/elf4j.spi.LoggerFactory b/src/test/resources/META-INF/services/elf4j.spi.LogServiceProvider
similarity index 96%
rename from src/test/resources/META-INF/services/elf4j.spi.LoggerFactory
rename to src/test/resources/META-INF/services/elf4j.spi.LogServiceProvider
index 647aa90..fd7a26e 100644
--- a/src/test/resources/META-INF/services/elf4j.spi.LoggerFactory
+++ b/src/test/resources/META-INF/services/elf4j.spi.LogServiceProvider
@@ -23,4 +23,4 @@
#
#
-elf4j.engine.NativeLoggerFactory
+elf4j.engine.NativeLogServiceProvider