Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Helper Class for java to for Logging purposes in much like android style.
import org.apache.log4j.Logger;
public class LogHelper {
/**
* helper class d() to log debug level information.
*/
public static void d(Class cls, String message)
{
Logger log = Logger.getLogger(cls);
log.debug(message);
}
/**
* helper class i() to log info level information.
*/
public static void i(Class cls, String message)
{
Logger log = Logger.getLogger(cls);
log.info(message);
}
/**
* helper class w() to log warning level information.
*/
public static void w(Class cls, String message)
{
Logger log = Logger.getLogger(cls);
log.warn(message);
}
/**
* helper class e() to log error information.
*/
public static void e(Class cls, String message)
{
Logger log = Logger.getLogger(cls);
log.error(message);
}
/**
* helper class f() to log fatal level information.
*/
public static void f(Class cls, String message)
{
Logger log = Logger.getLogger(cls);
log.fatal(message);
}
/**
* helper class t() to log trace information.
*/
public static void t(Class cls, String message)
{
Logger log = Logger.getLogger(cls);
log.trace(message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.