com.rt.core.log.Log Maven / Gradle / Ivy
package com.rt.core.log;
import com.rt.core.util.RTUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 日志工具
*/
public class Log {
private Logger log = null;
private Log(Class clazz) {
log = LoggerFactory.getLogger(clazz);
}
private Log(String name) {
log = LoggerFactory.getLogger(name);
}
public static Log getLog(Class clazz) {
return new Log(clazz);
}
public static Log getLog(String name) {
return new Log(name);
}
public void debug(String value) {
log.debug(value);
}
public void info(String value) {
log.info(value);
}
public void warn(String value) {
log.warn(value);
}
public void error(String value) {
log.error(value);
}
public void debug(String value, Exception e) {
if (e == null) {
return;
}
log.debug(value);
log.debug(RTUtil.exceptionToString(e));
}
public void info(String value, Exception e) {
if (e == null) {
return;
}
log.info(value);
log.info(RTUtil.exceptionToString(e));
}
public void warn(String value, Exception e) {
if (e == null) {
return;
}
log.warn(value);
log.warn(RTUtil.exceptionToString(e));
}
public void error(String value, Exception e) {
if (e == null) {
return;
}
log.error(value);
log.error(RTUtil.exceptionToString(e));
}
public void debug(Exception e) {
if (e == null) {
return;
}
log.debug(e.toString());
log.debug(RTUtil.exceptionToString(e));
}
public void info(Exception e) {
if (e == null) {
return;
}
log.info(e.toString());
log.info(RTUtil.exceptionToString(e));
}
public void warn(Exception e) {
if (e == null) {
return;
}
log.warn(e.toString());
log.warn(RTUtil.exceptionToString(e));
}
public void error(Exception e) {
if (e == null) {
return;
}
log.error(e.toString());
log.error(RTUtil.exceptionToString(e));
}
}