Bug 550399 - ILog should provide methods for logging with simple Strings
Change-Id: I8384a4b82246f115d186a48f56e41f67a99a9a45
Signed-off-by: laeubi <laeubi@laeubi-soft.de>
diff --git a/bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF
index 9d87683..a5473bb 100644
--- a/bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.runtime/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
-Bundle-Version: 3.16.100.qualifier
+Bundle-Version: 3.17.0.qualifier
Bundle-SymbolicName: org.eclipse.core.runtime; singleton:=true
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.core.internal.runtime.PlatformActivator
diff --git a/bundles/org.eclipse.core.runtime/pom.xml b/bundles/org.eclipse.core.runtime/pom.xml
index 299b5db..dc3f73b 100644
--- a/bundles/org.eclipse.core.runtime/pom.xml
+++ b/bundles/org.eclipse.core.runtime/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.runtime</artifactId>
- <version>3.16.100-SNAPSHOT</version>
+ <version>3.17.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java
index 4fe0fcb..5abb0f8 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/ILog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Christoph Läubrich - add methods for logging without a IStatus object
*******************************************************************************/
package org.eclipse.core.runtime;
@@ -62,4 +63,73 @@
* @see Platform#removeLogListener(ILogListener)
*/
public void removeLogListener(ILogListener listener);
+
+ /**
+ * Logs a status with {@link IStatus#INFO} using this logger
+ * {@link Bundle#getSymbolicName()} as pluginId
+ *
+ * @param message the message to log
+ * @since 3.17
+ */
+ default void info(String message) {
+ log(new Status(IStatus.INFO, getBundle().getSymbolicName(), message));
+ }
+
+ /**
+ * Logs a status with {@link IStatus#INFO} using this logger
+ * {@link Bundle#getSymbolicName()} as pluginId
+ *
+ * @param message the message to log
+ * @param throwable an optional throwable to associate with this status
+ * @since 3.17
+ */
+ default void info(String message, Throwable throwable) {
+ log(new Status(IStatus.INFO, getBundle().getSymbolicName(), message, throwable));
+ }
+
+ /**
+ * Logs a status with {@link IStatus#WARNING} using this logger
+ * {@link Bundle#getSymbolicName()} as pluginId
+ *
+ * @param message the message to log
+ * @since 3.17
+ */
+ default void warn(String message) {
+ log(new Status(IStatus.WARNING, getBundle().getSymbolicName(), message));
+ }
+
+ /**
+ * Logs a status with {@link IStatus#WARNING} using this logger
+ * {@link Bundle#getSymbolicName()} as pluginId
+ *
+ * @param message the message to log
+ * @param throwable an optional throwable to associate with this status
+ * @since 3.17
+ */
+ default void warn(String message, Throwable throwable) {
+ log(new Status(IStatus.WARNING, getBundle().getSymbolicName(), message, throwable));
+ }
+
+ /**
+ * Logs a status with {@link IStatus#ERROR} using this logger
+ * {@link Bundle#getSymbolicName()} as pluginId
+ *
+ * @param message the message to log
+ * @since 3.17
+ */
+ default void error(String message) {
+ log(new Status(IStatus.ERROR, getBundle().getSymbolicName(), message));
+ }
+
+ /**
+ * Logs a status with {@link IStatus#ERROR} using this logger
+ * {@link Bundle#getSymbolicName()} as pluginId
+ *
+ * @param message the message to log
+ * @param throwable an optional throwable to associate with this status
+ * @since 3.17
+ */
+ default void error(String message, Throwable throwable) {
+ log(new Status(IStatus.ERROR, getBundle().getSymbolicName(), message, throwable));
+ }
}