Replace isLessSpecificThan with helper function (for 1.7.10)
This commit is contained in:
@@ -62,6 +62,11 @@ public class ConfigBasedLogger
|
||||
loggers.add(new WeakReference<>(this));
|
||||
}
|
||||
|
||||
private static boolean isLessSpecificThan(Level _this, Level other)
|
||||
{
|
||||
return _this.intLevel() >= other.intLevel();
|
||||
}
|
||||
|
||||
private String _throwableToDetailString(Throwable t)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -95,16 +100,16 @@ public class ConfigBasedLogger
|
||||
: this.logger.getMessageFactory().newMessage("{}", str);
|
||||
|
||||
String msgStr = msg.getFormattedMessage();
|
||||
if (mode.levelForFile.isLessSpecificThan(level))
|
||||
if (isLessSpecificThan(mode.levelForFile, level))
|
||||
{
|
||||
Level logLevel = level.isLessSpecificThan(Level.INFO) ? Level.INFO : level;
|
||||
Level logLevel = isLessSpecificThan(level, Level.INFO) ? Level.INFO : level;
|
||||
if (param.length > 0 && param[param.length - 1] instanceof Throwable)
|
||||
logger.log(logLevel, msgStr, (Throwable) param[param.length - 1]);
|
||||
else
|
||||
logger.log(logLevel, msgStr);
|
||||
}
|
||||
|
||||
if (MC != null && mode.levelForChat.isLessSpecificThan(level))
|
||||
if (MC != null && isLessSpecificThan(mode.levelForChat, level))
|
||||
{
|
||||
if (param.length > 0 && param[param.length - 1] instanceof Throwable)
|
||||
MC.logToChat(level, msgStr + "\n" +
|
||||
|
||||
+11
-6
@@ -67,6 +67,11 @@ public class ConfigBasedSpamLogger
|
||||
loggers.add(new WeakReference<>(this));
|
||||
}
|
||||
|
||||
private static boolean isLessSpecificThan(Level _this, Level other)
|
||||
{
|
||||
return _this.intLevel() >= other.intLevel();
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
logTries.set(0);
|
||||
@@ -105,15 +110,15 @@ public class ConfigBasedSpamLogger
|
||||
|
||||
Message msg = logger.getMessageFactory().newMessage(str, param);
|
||||
String msgStr = msg.getFormattedMessage();
|
||||
if (mode.levelForFile.isLessSpecificThan(level))
|
||||
if (isLessSpecificThan(mode.levelForFile, level))
|
||||
{
|
||||
Level logLevel = level.isLessSpecificThan(Level.INFO) ? Level.INFO : level;
|
||||
Level logLevel = isLessSpecificThan(level, Level.INFO) ? Level.INFO : level;
|
||||
if (param.length > 0 && param[param.length - 1] instanceof Throwable)
|
||||
logger.log(logLevel, msgStr, (Throwable) param[param.length - 1]);
|
||||
else
|
||||
logger.log(logLevel, msgStr);
|
||||
}
|
||||
if (mode.levelForChat.isLessSpecificThan(level))
|
||||
if (isLessSpecificThan(mode.levelForChat, level))
|
||||
{
|
||||
if (param.length > 0 && param[param.length - 1] instanceof Throwable)
|
||||
MC.logToChat(level, msgStr + "\n" +
|
||||
@@ -160,15 +165,15 @@ public class ConfigBasedSpamLogger
|
||||
|
||||
Message msg = logger.getMessageFactory().newMessage(str, param);
|
||||
String msgStr = msg.getFormattedMessage();
|
||||
if (mode.levelForFile.isLessSpecificThan(level))
|
||||
if (isLessSpecificThan(mode.levelForFile, level))
|
||||
{
|
||||
Level logLevel = level.isLessSpecificThan(Level.INFO) ? Level.INFO : level;
|
||||
Level logLevel = isLessSpecificThan(level, Level.INFO) ? Level.INFO : level;
|
||||
if (param.length > 0 && param[param.length - 1] instanceof Throwable)
|
||||
logger.log(logLevel, msgStr, (Throwable) param[param.length - 1]);
|
||||
else
|
||||
logger.log(logLevel, msgStr);
|
||||
}
|
||||
if (mode.levelForChat.isLessSpecificThan(level))
|
||||
if (isLessSpecificThan(mode.levelForChat, level))
|
||||
{
|
||||
if (param.length > 0 && param[param.length - 1] instanceof Throwable)
|
||||
MC.logToChat(level, msgStr + "\n" +
|
||||
|
||||
@@ -56,6 +56,11 @@ public class SpamReducedLogger
|
||||
loggers.add(new WeakReference<SpamReducedLogger>(this));
|
||||
}
|
||||
|
||||
private static boolean isLessSpecificThan(Level _this, Level other)
|
||||
{
|
||||
return _this.intLevel() >= other.intLevel();
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
logTries.set(0);
|
||||
@@ -70,7 +75,7 @@ public class SpamReducedLogger
|
||||
{
|
||||
if (logTries.get() >= maxLogCount)
|
||||
return;
|
||||
LOGGER.log(level.isLessSpecificThan(Level.INFO) ? Level.INFO : level, str, param);
|
||||
LOGGER.log(isLessSpecificThan(level, Level.INFO) ? Level.INFO : level, str, param);
|
||||
}
|
||||
|
||||
public void error(String str, Object... param)
|
||||
@@ -107,7 +112,7 @@ public class SpamReducedLogger
|
||||
{
|
||||
if (logTries.getAndIncrement() >= maxLogCount)
|
||||
return;
|
||||
LOGGER.log(level.isLessSpecificThan(Level.INFO) ? Level.INFO : level, str, param);
|
||||
LOGGER.log(isLessSpecificThan(level, Level.INFO) ? Level.INFO : level, str, param);
|
||||
}
|
||||
|
||||
public void errorInc(String str, Object... param)
|
||||
|
||||
Reference in New Issue
Block a user