org.openxma.dsl.common.logging.LogUtil Maven / Gradle / Ivy
package org.openxma.dsl.common.logging;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Utility for logging
*
*/
public class LogUtil {
private static final Log logger = LogFactory.getLog(LogUtil.class);
/**
*
* @param desc
*/
public static String info(String desc) {
logger.info(desc);
return desc;
}
/**
*
* @param desc
*/
public static String warn(String desc) {
logger.warn(desc);
return desc;
}
/**
*
* @param desc
*/
public static String log(String desc) {
System.out.println(desc);
logger.info(desc);
return desc;
}
/**
*
* @param desc
*/
public static String error(String desc) {
logger.error(desc);
throw new RuntimeException(desc);
}
public static Object createTimeMeasurement(String string) {
TimeMeasurement tm = new TimeMeasurement(string);
return tm;
}
public static Object createTimeMeasurement(String category, String string) {
TimeMeasurement tm = new TimeMeasurement(category,string);
return tm;
}
public static void beginTimeMeasurement(Object obj) {
TimeMeasurement tm = (TimeMeasurement)obj;
tm.begin();
}
public static void endTimeMeasurement(Object obj) {
TimeMeasurement tm = (TimeMeasurement)obj;
tm.end();
}
}