Remove log4j as much as possible (#1334)

This commit is contained in:
altrisi authored and GitHub committed 2022-02-22 01:35:56 +01:00
1 parent b06d68186e
commit 1f0c609dc0
9 files changed
+26 -22

No files matched your search

@@ -34,8 +34,8 @@ import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.storage.LevelResource;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.FileVisitOption;
@@ -57,7 +57,7 @@ import java.util.stream.Collectors;
public class CarpetScriptServer
{
//make static for now, but will change that later:
public static final Logger LOG = LogManager.getLogger("scarpet");
public static final Logger LOG = LoggerFactory.getLogger("Scarpet");
public final MinecraftServer server;
public CarpetScriptHost globalHost;
public Map<String, CarpetScriptHost> modules;
+3 -4
View File
@@ -4,13 +4,12 @@ import carpet.script.bundled.Module;
import carpet.script.exception.ExpressionException;
import carpet.script.exception.IntegrityException;
import carpet.script.exception.InternalExpressionException;
import carpet.script.language.Arithmetic;
import carpet.script.value.FunctionValue;
import carpet.script.value.Value;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.HashSet;
@@ -440,7 +439,7 @@ public abstract class ScriptHost
errorSnooper=null;
}
public static final Logger DEPRECATION_LOG = LogManager.getLogger("Scarpet Deprecation Warnings");
public static final Logger DEPRECATION_LOG = LoggerFactory.getLogger("Scarpet Deprecation Warnings");
public boolean issueDeprecation(String feature)
{
@@ -830,11 +830,14 @@ public class Auxiliary {
String level = lv.get(0).getString().toLowerCase(Locale.ROOT);
res = lv.get(1);
switch(level){
case "error": CarpetScriptServer.LOG.error(res.getString()); break;
case "warn": CarpetScriptServer.LOG.warn(res.getString()); break;
case "debug": CarpetScriptServer.LOG.debug(res.getString()); break;
case "fatal": CarpetScriptServer.LOG.fatal(res.getString()); break;
case "warn": CarpetScriptServer.LOG.warn(res.getString()); break;
case "info": CarpetScriptServer.LOG.info(res.getString()); break;
case "fatal":
// Somehow issue deprecation
case "error":
CarpetScriptServer.LOG.error(res.getString());
break;
default: throw new InternalExpressionException("Unknown log level for 'logger': "+level);
}
}
@@ -379,9 +379,9 @@ public class FileArgument
}
catch (IOException secondIO)
{
CarpetScriptServer.LOG.warn("IOException when trying to read nbt file, something may have gone wrong with the fs",e);
CarpetScriptServer.LOG.catching(ioException);
CarpetScriptServer.LOG.catching(secondIO);
CarpetScriptServer.LOG.warn("IOException when trying to read nbt file, something may have gone wrong with the fs", e);
CarpetScriptServer.LOG.warn("", ioException);
CarpetScriptServer.LOG.warn("", secondIO);
throw new ThrowStatement("Not a valid NBT tag in "+path.toString(), Throwables.NBT_ERROR);
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ public abstract class Value implements Comparable<Value>, Cloneable
catch (CloneNotSupportedException e)
{
// should not happen
CarpetSettings.LOG.catching(e);
CarpetSettings.LOG.error("Failed to clone variable", e);
throw new InternalExpressionException("Variable of type "+getTypeString()+" is not cloneable. Tell gnembon about it, this shoudn't happen");
}
copy.boundVariable = var;