]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/winterwell.markdown/src/winterwell/markdown/LogUtil.java
migrated to svn revision 33108
[simantics/platform.git] / bundles / winterwell.markdown / src / winterwell / markdown / LogUtil.java
1 package winterwell.markdown;
2
3 import org.eclipse.core.runtime.ILog;
4 import org.eclipse.core.runtime.IStatus;
5 import org.eclipse.core.runtime.Status;
6
7 /**
8  * Nodeclipse Log Util
9  * @author Lamb Gao, Paul Verest
10  */
11 public class LogUtil {
12
13     public static void info(String message) {
14         log(IStatus.INFO, IStatus.OK, message, null);
15     }
16
17     public static void error(Throwable exception) {
18         error("Unexpected Exception", exception);
19     }
20
21     public static void error(String message) {
22         error(message, null);
23     }
24
25     public static void error(String message, Throwable exception) {
26         log(IStatus.ERROR, IStatus.ERROR, message, exception);
27     }
28
29     public static void log(int severity, int code, String message, Throwable exception) {
30         log(createStatus(severity, code, message, exception));
31     }
32
33     public static IStatus createStatus(int severity, int code, String message, Throwable exception) {
34         return new Status(severity, Activator.PLUGIN_ID, code, message, exception);
35     }
36
37     public static void log(IStatus status) {
38         ILog log = Activator.getDefault().getLog();
39         log.log(status);
40     }
41 }