diff --git a/cli/src/main/java/com/devonfw/tools/ide/cli/Ideasy.java b/cli/src/main/java/com/devonfw/tools/ide/cli/Ideasy.java index ae148c221..484b0321d 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/cli/Ideasy.java +++ b/cli/src/main/java/com/devonfw/tools/ide/cli/Ideasy.java @@ -3,6 +3,9 @@ import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.devonfw.tools.ide.commandlet.ContextCommandlet; import com.devonfw.tools.ide.context.AbstractIdeContext; import com.devonfw.tools.ide.context.IdeContext; @@ -24,6 +27,8 @@ public final class Ideasy { * * @param args the command-line arguments. */ + private static final Logger logger = LoggerFactory.getLogger(Ideasy.class); + public static void main(String... args) { int exitStatus = new Ideasy().run(args); diff --git a/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestLogger.java b/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestLogger.java new file mode 100644 index 000000000..5c29fd0d0 --- /dev/null +++ b/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestLogger.java @@ -0,0 +1,329 @@ +package com.devonfw.tools.ide.serviceprovider; + +import org.slf4j.Marker; + +public class TestLogger implements org.slf4j.Logger { + + private final String name; + + public TestLogger(String name) { + + this.name = name; + } + + @Override + public String getName() { + + return name; + } + + @Override + public boolean isTraceEnabled() { + + return false; + } + + @Override + public void trace(String s) { + + } + + @Override + public void trace(String s, Object o) { + + } + + @Override + public void trace(String s, Object o, Object o1) { + + } + + @Override + public void trace(String s, Object... objects) { + + } + + @Override + public void trace(String s, Throwable throwable) { + + } + + @Override + public boolean isTraceEnabled(Marker marker) { + + return false; + } + + @Override + public void trace(Marker marker, String s) { + + } + + @Override + public void trace(Marker marker, String s, Object o) { + + } + + @Override + public void trace(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void trace(Marker marker, String s, Object... objects) { + + } + + @Override + public void trace(Marker marker, String s, Throwable throwable) { + + } + + @Override + public boolean isDebugEnabled() { + + return true; + } + + @Override + public void debug(String s) { + + } + + @Override + public void debug(String s, Object o) { + + } + + @Override + public void debug(String s, Object o, Object o1) { + + } + + @Override + public void debug(String s, Object... objects) { + + } + + @Override + public void debug(String s, Throwable throwable) { + + } + + @Override + public boolean isDebugEnabled(Marker marker) { + + return false; + } + + @Override + public void debug(Marker marker, String s) { + + } + + @Override + public void debug(Marker marker, String s, Object o) { + + } + + @Override + public void debug(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void debug(Marker marker, String s, Object... objects) { + + } + + @Override + public void debug(Marker marker, String s, Throwable throwable) { + + } + + @Override + public boolean isInfoEnabled() { + + return false; + } + + @Override + public void info(String s) { + + } + + @Override + public void info(String s, Object o) { + + } + + @Override + public void info(String s, Object o, Object o1) { + + } + + @Override + public void info(String s, Object... objects) { + + } + + @Override + public void info(String s, Throwable throwable) { + + } + + @Override + public boolean isInfoEnabled(Marker marker) { + + return false; + } + + @Override + public void info(Marker marker, String s) { + + } + + @Override + public void info(Marker marker, String s, Object o) { + + } + + @Override + public void info(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void info(Marker marker, String s, Object... objects) { + + } + + @Override + public void info(Marker marker, String s, Throwable throwable) { + + } + + @Override + public boolean isWarnEnabled() { + + return false; + } + + @Override + public void warn(String s) { + + } + + @Override + public void warn(String s, Object o) { + + } + + @Override + public void warn(String s, Object... objects) { + + } + + @Override + public void warn(String s, Object o, Object o1) { + + } + + @Override + public void warn(String s, Throwable throwable) { + + } + + @Override + public boolean isWarnEnabled(Marker marker) { + + return false; + } + + @Override + public void warn(Marker marker, String s) { + + } + + @Override + public void warn(Marker marker, String s, Object o) { + + } + + @Override + public void warn(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void warn(Marker marker, String s, Object... objects) { + + } + + @Override + public void warn(Marker marker, String s, Throwable throwable) { + + } + + @Override + public boolean isErrorEnabled() { + + return false; + } + + @Override + public void error(String s) { + + } + + @Override + public void error(String s, Object o) { + + } + + @Override + public void error(String s, Object o, Object o1) { + + } + + @Override + public void error(String s, Object... objects) { + + } + + @Override + public void error(String s, Throwable throwable) { + + } + + @Override + public boolean isErrorEnabled(Marker marker) { + + return false; + } + + @Override + public void error(Marker marker, String s) { + + } + + @Override + public void error(Marker marker, String s, Object o) { + + } + + @Override + public void error(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void error(Marker marker, String s, Object... objects) { + + } + + @Override + public void error(Marker marker, String s, Throwable throwable) { + + } +} diff --git a/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestLoggerFactory.java b/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestLoggerFactory.java new file mode 100644 index 000000000..796a69c1d --- /dev/null +++ b/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestLoggerFactory.java @@ -0,0 +1,13 @@ +package com.devonfw.tools.ide.serviceprovider; + +import org.slf4j.ILoggerFactory; +import org.slf4j.Logger; + +public class TestLoggerFactory implements ILoggerFactory { + + @Override + public Logger getLogger(String name) { + + return new TestLogger(name); + } +} diff --git a/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestProvider.java b/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestProvider.java new file mode 100644 index 000000000..98cea9186 --- /dev/null +++ b/cli/src/main/java/com/devonfw/tools/ide/serviceprovider/TestProvider.java @@ -0,0 +1,43 @@ +package com.devonfw.tools.ide.serviceprovider; + +import org.slf4j.ILoggerFactory; +import org.slf4j.IMarkerFactory; +import org.slf4j.helpers.NOPMDCAdapter; +import org.slf4j.spi.MDCAdapter; +import org.slf4j.spi.SLF4JServiceProvider; + +public class TestProvider implements SLF4JServiceProvider { + + private final String REQUESTED_API_VERSION = "2.0.12"; + private TestLoggerFactory testLoggerFactory; + + + @Override + public ILoggerFactory getLoggerFactory() { + + return testLoggerFactory; + } + + @Override + public IMarkerFactory getMarkerFactory() { + + return null; + } + + @Override + public MDCAdapter getMDCAdapter() { + + return new NOPMDCAdapter(); + } + + @Override + public String getRequestedApiVersion() { + + return REQUESTED_API_VERSION; + } + + @Override + public void initialize() { + testLoggerFactory = new TestLoggerFactory(); + } +} diff --git a/cli/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider b/cli/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider new file mode 100644 index 000000000..9ea9509eb --- /dev/null +++ b/cli/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider @@ -0,0 +1 @@ +com.devonfw.tools.ide.serviceprovider.TestProvider