All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openxma.dsl.common.logging.LogUtil Maven / Gradle / Ivy

There is a newer version: 6.0.2
Show newest version
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();		
	}		
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy