X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Fwinterwell.markdown%2Fsrc%2Fwinterwell%2Fmarkdown%2FLogUtil.java;fp=bundles%2Fwinterwell.markdown%2Fsrc%2Fwinterwell%2Fmarkdown%2FLogUtil.java;h=384b951c459d6570d006cb62438bbe4c3fe1a0d8;hp=0000000000000000000000000000000000000000;hb=9a175feb652b2b7bba7afa540831b9076be3c10e;hpb=0b72d3e4ec886838314ffeba0fa201e32c0aae3e diff --git a/bundles/winterwell.markdown/src/winterwell/markdown/LogUtil.java b/bundles/winterwell.markdown/src/winterwell/markdown/LogUtil.java new file mode 100644 index 000000000..384b951c4 --- /dev/null +++ b/bundles/winterwell.markdown/src/winterwell/markdown/LogUtil.java @@ -0,0 +1,41 @@ +package winterwell.markdown; + +import org.eclipse.core.runtime.ILog; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * Nodeclipse Log Util + * @author Lamb Gao, Paul Verest + */ +public class LogUtil { + + public static void info(String message) { + log(IStatus.INFO, IStatus.OK, message, null); + } + + public static void error(Throwable exception) { + error("Unexpected Exception", exception); + } + + public static void error(String message) { + error(message, null); + } + + public static void error(String message, Throwable exception) { + log(IStatus.ERROR, IStatus.ERROR, message, exception); + } + + public static void log(int severity, int code, String message, Throwable exception) { + log(createStatus(severity, code, message, exception)); + } + + public static IStatus createStatus(int severity, int code, String message, Throwable exception) { + return new Status(severity, Activator.PLUGIN_ID, code, message, exception); + } + + public static void log(IStatus status) { + ILog log = Activator.getDefault().getLog(); + log.log(status); + } +}