Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2017-11-03 15:41:37 +0000
committerThomas Watson2017-11-03 15:44:09 +0000
commitaf9796c48cdef3e4f83fbd382fbb69b4441267c4 (patch)
tree9cee46f4f8bc9e12af7b48d244cecd85f921f4e8 /bundles/org.eclipse.osgi/container
parent31812841909c750095865d82b0b87c55b4797c6f (diff)
downloadrt.equinox.framework-af9796c48cdef3e4f83fbd382fbb69b4441267c4.tar.gz
rt.equinox.framework-af9796c48cdef3e4f83fbd382fbb69b4441267c4.tar.xz
rt.equinox.framework-af9796c48cdef3e4f83fbd382fbb69b4441267c4.zip
Change-Id: Ibec9d2adcd3cb52dafa8d25d3b8466af448f0270 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.osgi/container')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java26
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LoggerImpl.java38
2 files changed, 62 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java
index cc4d186cd..43c1a1efe 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java
@@ -15,6 +15,7 @@ import org.eclipse.osgi.internal.log.ExtendedLogServiceFactory.EquinoxLoggerCont
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.FormatterLogger;
+import org.osgi.service.log.LoggerConsumer;
import org.osgi.service.log.admin.LoggerContext;
public class ExtendedLogServiceImpl implements ExtendedLogService {
@@ -308,6 +309,31 @@ public class ExtendedLogServiceImpl implements ExtendedLogService {
getLogger((String) null).audit(format, arguments);
}
+ @Override
+ public <E extends Exception> void trace(LoggerConsumer<E> consumer) throws E {
+ getLogger((String) null).trace(consumer);
+ }
+
+ @Override
+ public <E extends Exception> void debug(LoggerConsumer<E> consumer) throws E {
+ getLogger((String) null).debug(consumer);
+ }
+
+ @Override
+ public <E extends Exception> void info(LoggerConsumer<E> consumer) throws E {
+ getLogger((String) null).info(consumer);
+ }
+
+ @Override
+ public <E extends Exception> void warn(LoggerConsumer<E> consumer) throws E {
+ getLogger((String) null).warn(consumer);
+ }
+
+ @Override
+ public <E extends Exception> void error(LoggerConsumer<E> consumer) throws E {
+ getLogger((String) null).error(consumer);
+ }
+
void applyLogLevels(EquinoxLoggerContext effectiveLoggerContext) {
for (Map<String, LoggerImpl> loggers : loggerCache.values()) {
for (LoggerImpl logger : loggers.values()) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LoggerImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LoggerImpl.java
index 1876e10ba..90a2ee3bf 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LoggerImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LoggerImpl.java
@@ -12,8 +12,7 @@ import java.util.regex.Pattern;
import org.eclipse.equinox.log.Logger;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogLevel;
-import org.osgi.service.log.LogService;
+import org.osgi.service.log.*;
import org.osgi.service.log.admin.LoggerContext;
public class LoggerImpl implements Logger {
@@ -238,6 +237,41 @@ public class LoggerImpl implements Logger {
log(LogLevel.AUDIT, format, arguments);
}
+ @Override
+ public <E extends Exception> void trace(LoggerConsumer<E> consumer) throws E {
+ if (isTraceEnabled()) {
+ consumer.accept(this);
+ }
+ }
+
+ @Override
+ public <E extends Exception> void debug(LoggerConsumer<E> consumer) throws E {
+ if (isDebugEnabled()) {
+ consumer.accept(this);
+ }
+ }
+
+ @Override
+ public <E extends Exception> void info(LoggerConsumer<E> consumer) throws E {
+ if (isInfoEnabled()) {
+ consumer.accept(this);
+ }
+ }
+
+ @Override
+ public <E extends Exception> void warn(LoggerConsumer<E> consumer) throws E {
+ if (isWarnEnabled()) {
+ consumer.accept(this);
+ }
+ }
+
+ @Override
+ public <E extends Exception> void error(LoggerConsumer<E> consumer) throws E {
+ if (isErrorEnabled()) {
+ consumer.accept(this);
+ }
+ }
+
private static final Pattern pattern = Pattern.compile("(\\\\?)(\\\\?)(\\{\\})"); //$NON-NLS-1$
private void log(LogLevel level, String format, Object... arguments) {

Back to the top