Update Upstream

609c7b8 Scrapped Logging Framework 4 Java

Closes #997
Closes #998
Closes #999
Closes #1000
Closes #1001
Closes #1002
This commit is contained in:
NotMyFault
2021-03-29 15:29:16 +02:00
parent 2dc89f735d
commit b96cea75b8
118 changed files with 700 additions and 743 deletions

View File

@ -121,6 +121,7 @@ import com.sk89q.worldedit.internal.command.ConfirmHandler;
import com.sk89q.worldedit.internal.command.MethodInjector;
import com.sk89q.worldedit.internal.command.exception.ExceptionConverter;
import com.sk89q.worldedit.internal.command.exception.WorldEditExceptionConverter;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.internal.util.Substring;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.session.SessionKey;
@ -133,6 +134,7 @@ import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.logging.DynamicStreamHandler;
import com.sk89q.worldedit.util.logging.LogFormat;
import com.sk89q.worldedit.world.World;
import org.apache.logging.log4j.Logger;
import org.enginehub.piston.Command;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.converter.ArgumentConverter;
@ -155,8 +157,6 @@ import org.enginehub.piston.suggestion.Suggestion;
import org.enginehub.piston.util.HelpGenerator;
import org.enginehub.piston.util.ValueProvider;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@ -185,7 +185,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public final class PlatformCommandManager {
public static final Pattern COMMAND_CLEAN_PATTERN = Pattern.compile("^[/]+");
private static final Logger log = LoggerFactory.getLogger(PlatformCommandManager.class);
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static final java.util.logging.Logger COMMAND_LOG =
java.util.logging.Logger.getLogger("com.sk89q.worldedit.CommandLog");
@ -567,7 +567,7 @@ public final class PlatformCommandManager {
}
void registerCommandsWith(Platform platform) {
log.info("Registering commands with " + platform.getClass().getCanonicalName());
LOGGER.info("Registering commands with " + platform.getClass().getCanonicalName());
LocalConfiguration config = platform.getConfiguration();
@ -582,12 +582,12 @@ public final class PlatformCommandManager {
File file = new File(config.getWorkingDirectory(), path);
COMMAND_LOG.setLevel(Level.ALL);
log.info("Logging WorldEdit commands to " + file.getAbsolutePath());
LOGGER.info("Logging WorldEdit commands to " + file.getAbsolutePath());
try {
dynamicHandler.setHandler(new FileHandler(file.getAbsolutePath(), true));
} catch (IOException e) {
log.warn("Could not use command log file " + path + ": " + e.getMessage());
LOGGER.warn("Could not use command log file " + path + ": " + e.getMessage());
}
dynamicHandler.setFormatter(new LogFormat(config.logFormat));
@ -828,7 +828,7 @@ public final class PlatformCommandManager {
private void handleUnknownException(Actor actor, Throwable t) {
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
actor.print(TextComponent.of(t.getClass().getName() + ": " + t.getMessage()));
log.error("An unexpected error while handling a WorldEdit command", t);
LOGGER.error("An unexpected error while handling a WorldEdit command", t);
}
@Subscribe
@ -848,7 +848,7 @@ public final class PlatformCommandManager {
suggestions = commandManager.getSuggestions(access, argStrings);
} catch (Throwable t) { // catch errors which are *not* command exceptions generated by parsers/suggesters
if (!(t instanceof CommandException)) {
log.debug("Unexpected error occurred while generating suggestions for input: " + arguments, t);
LOGGER.debug("Unexpected error occurred while generating suggestions for input: " + arguments, t);
return;
}
throw t;