io.github.kits.log.Logger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of whimthen-kits Show documentation
Show all versions of whimthen-kits Show documentation
Easy to use java tool library.
The newest version!
package io.github.kits.log;
import io.github.kits.enums.PropEnum;
import static io.github.kits.log.LoggerFomtter.writeLog;
/**
* 日志工具类
*
* @project: kits
* @created: with IDEA
* @author: kits
* @date: 2018 04 26 下午12:51 | 四月. 星期四
*/
public class Logger {
static {
if (LoggerThread.mainLogThrad == null) {
LoggerThread.start();
}
}
public static void info(Object message) {
writeLog(PropEnum.LOGGER_INFO.getProp(), false, message, null);
}
public static void infoln(Object message) {
writeLog(PropEnum.LOGGER_INFO.getProp(), true, message, null);
}
public static void infof(String message, Object... args) {
writeLog(PropEnum.LOGGER_INFO.getProp(), false, message, null, args);
}
public static void infofln(String message, Object... args) {
writeLog(PropEnum.LOGGER_INFO.getProp(), true, message, null, args);
}
public static void debug(Object message) {
writeLog(PropEnum.LOGGER_DEBUG.getProp(), false, message, null);
}
public static void debugln(Object message) {
writeLog(PropEnum.LOGGER_DEBUG.getProp(), true, message, null);
}
public static void debugf(String message, Object... args) {
writeLog(PropEnum.LOGGER_DEBUG.getProp(), false, message, null, args);
}
public static void debugfln(String message, Object... args) {
writeLog(PropEnum.LOGGER_DEBUG.getProp(), true, message, null, args);
}
public static void warn(Object message) {
writeLog(PropEnum.LOGGER_WARN.getProp(), false, message, null);
}
public static void warnln(Object message) {
writeLog(PropEnum.LOGGER_WARN.getProp(), true, message, null);
}
public static void warnf(String message, Object... args) {
writeLog(PropEnum.LOGGER_WARN.getProp(), false, message, null, args);
}
public static void warnfln(String message, Object... args) {
writeLog(PropEnum.LOGGER_WARN.getProp(), true, message, null, args);
}
public static void error(Object message) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), false, message, null);
}
public static void errorln(Object message) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), true, message, null);
}
public static void error(Throwable exception) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), false, null, exception);
}
public static void errorln(Throwable exception) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), true, null, exception);
}
public static void error(String message, Exception exception) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), false, message, exception);
}
public static void errorln(String message, Exception exception) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), true, message, exception);
}
public static void errorf(String message, Object... args) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), false, message, null, args);
}
public static void errorfln(String message, Object... args) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), true, message, null, args);
}
public static void errorf(String message, Exception exception, Object... args) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), false, message, exception, args);
}
public static void errorfln(String message, Exception exception, Object... args) {
writeLog(PropEnum.LOGGER_ERROR.getProp(), true, message, exception, args);
}
public static boolean isDebugEnabled() {
return LoggerThread.logLevel.contains(PropEnum.LOGGER_DEBUG.getProp());
}
public static void setLevel(String level) {
LoggerFomtter.setLevel(level);
}
}