]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SelectLoggingLevelHandler.java
Logging configuration via SCL and UI & saving to ZIP-archive
[simantics/platform.git] / bundles / org.simantics.logging.ui / src / org / simantics / logging / ui / handlers / SelectLoggingLevelHandler.java
diff --git a/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SelectLoggingLevelHandler.java b/bundles/org.simantics.logging.ui/src/org/simantics/logging/ui/handlers/SelectLoggingLevelHandler.java
new file mode 100644 (file)
index 0000000..27473f1
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.logging.ui.handlers;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.simantics.logging.LogConfigurator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SelectLoggingLevelHandler {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SelectLoggingLevelHandler.class);
+
+    @Execute
+    public void execute(@Named("org.simantics.logging.ui.commandparameter.selectLoggingLevel") String level) {
+        if (LOGGER.isDebugEnabled())
+            LOGGER.debug("Setting logging level to {}", level);
+        LogConfigurator.setLoggingLevel(level);
+    }
+
+}