/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 Association for Decentralized Information Management
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.simantics.utils.ui.internal.Activator;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* ErrorLogger sends error messages to "Error log" view.
*
* @author Toni Kalajainen
+ * @author Jani Simomaa
*/
public class ErrorLogger {
- public static final boolean ECHO = true;
-
+ private static final Logger LOGGER = LoggerFactory.getLogger(ErrorLogger.class);
private final Plugin plugin;
private String pluginID;
*/
public void logWarning(String message, Throwable exception) {
log(IStatus.WARNING, IStatus.OK, message, exception);
+ LOGGER.warn(message, exception);
}
/**
*/
public void logMessage(String message, Throwable exception) {
log(IStatus.INFO, IStatus.OK, message, exception);
+ LOGGER.info(message, exception);
}
/**
exception = new RuntimeException();
}
log(IStatus.ERROR, IStatus.OK, message, exception);
+ LOGGER.error(message, exception);
}
public void log(int severity, int code, String message, Throwable exception) {
public static void defaultLogError(String message, Throwable exception) {
getDefault().logError(message, exception);
- if(ECHO && exception != null) exception.printStackTrace();
}
public static void defaultLogError(Throwable exception) {
getDefault().logError(getUIFriendErrorMessage(exception), exception);
- if(ECHO && exception != null) exception.printStackTrace();
}
public static void defaultLogWarning(String message, Throwable exception) {
getDefault().logWarning(message, exception);
- if(ECHO && exception != null) exception.printStackTrace();
}
public static void defaultLogWarning(Throwable exception) {
getDefault().logWarning(getUIFriendErrorMessage(exception), exception);
- if(ECHO && exception != null) exception.printStackTrace();
}
public static void defaultLog(IStatus status) {
getDefault().log(status);
- if(ECHO) System.out.println(status);
}
/**