Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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