feat:(1.2.0-beta2): 删除日志的全局开关

This commit is contained in:
opensnail 2024-09-24 16:46:31 +08:00
parent e2bde7e40c
commit ab03ec99eb
2 changed files with 0 additions and 72 deletions

View File

@ -17,13 +17,6 @@ public class GlobalLogFactory {
private static volatile LogFactory currentLogFactory; private static volatile LogFactory currentLogFactory;
private static final Object lock = new Object(); private static final Object lock = new Object();
private static Environment environment;
public static void setEnvironment(final Environment environment) {
GlobalLogFactory.environment = environment;
}
/** /**
* 获取单例日志工厂类如果不存在创建之 * 获取单例日志工厂类如果不存在创建之
* *
@ -72,17 +65,4 @@ public class GlobalLogFactory {
return currentLogFactory; return currentLogFactory;
} }
/**
* 获取全局的日志开关
*
* @return
*/
public static Boolean logSwitch() {
if (Objects.nonNull(environment)) {
return environment.getProperty("snail-job.log.status", Boolean.class, Boolean.TRUE);
}
return Boolean.TRUE;
}
} }

View File

@ -30,10 +30,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void trace(String format, Object... arguments) { public void trace(String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
trace(LogFactory.get(LogCaller.getCallerCaller()), format, arguments); trace(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
} }
@ -45,10 +41,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void trace(Log log, String format, Object... arguments) { public void trace(Log log, String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
log.trace(isRemote, FQCN, format, arguments); log.trace(isRemote, FQCN, format, arguments);
} }
@ -61,10 +53,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void debug(String format, Object... arguments) { public void debug(String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
debug(LogFactory.get(LogCaller.getCallerCaller()), format, arguments); debug(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
} }
@ -76,10 +64,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void debug(Log log, String format, Object... arguments) { public void debug(Log log, String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
log.debug(isRemote, FQCN, format, arguments); log.debug(isRemote, FQCN, format, arguments);
} }
@ -92,10 +76,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void info(String format, Object... arguments) { public void info(String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
info(LogFactory.get(LogCaller.getCallerCaller()), format, arguments); info(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
} }
@ -107,10 +87,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void info(Log log, String format, Object... arguments) { public void info(Log log, String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
log.info(isRemote, FQCN, format, arguments); log.info(isRemote, FQCN, format, arguments);
} }
@ -123,10 +99,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void warn(String format, Object... arguments) { public void warn(String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
warn(LogFactory.get(LogCaller.getCallerCaller()), format, arguments); warn(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
} }
@ -138,10 +110,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void warn(Log log, String format, Object... arguments) { public void warn(Log log, String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
log.warn(isRemote, FQCN, format, arguments); log.warn(isRemote, FQCN, format, arguments);
} }
@ -153,10 +121,6 @@ public abstract class AbstractLog {
* @param e 需在日志中堆栈打印的异常 * @param e 需在日志中堆栈打印的异常
*/ */
public void error(Throwable e) { public void error(Throwable e) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
error(LogFactory.get(LogCaller.getCallerCaller()), e); error(LogFactory.get(LogCaller.getCallerCaller()), e);
} }
@ -167,10 +131,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void error(String format, Object... arguments) { public void error(String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
error(LogFactory.get(LogCaller.getCallerCaller()), format, arguments); error(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
} }
@ -181,10 +141,6 @@ public abstract class AbstractLog {
* @param e 需在日志中堆栈打印的异常 * @param e 需在日志中堆栈打印的异常
*/ */
public void error(Log log, Throwable e) { public void error(Log log, Throwable e) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
log.error(false, e); log.error(false, e);
} }
@ -196,10 +152,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void error(Log log, String format, Object... arguments) { public void error(Log log, String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
log.error(isRemote, FQCN, format, arguments); log.error(isRemote, FQCN, format, arguments);
} }
@ -213,10 +165,6 @@ public abstract class AbstractLog {
* @param arguments 变量对应的参数 * @param arguments 变量对应的参数
*/ */
public void log(Level level, Boolean remote, String format, Object... arguments) { public void log(Level level, Boolean remote, String format, Object... arguments) {
if (!GlobalLogFactory.logSwitch()) {
return;
}
LogFactory.get(LogCaller.getCallerCaller()).log(level, remote, FQCN, format, arguments); LogFactory.get(LogCaller.getCallerCaller()).log(level, remote, FQCN, format, arguments);
} }
} }