mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Switch to SLF4J logging.
This commit is contained in:
@ -27,6 +27,8 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -39,8 +41,6 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Simple LocalConfiguration that loads settings using
|
||||
@ -48,7 +48,7 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class PropertiesConfiguration extends LocalConfiguration {
|
||||
|
||||
@Unreported private static final Logger log = Logger.getLogger(PropertiesConfiguration.class.getCanonicalName());
|
||||
@Unreported private static final Logger log = LoggerFactory.getLogger(PropertiesConfiguration.class);
|
||||
|
||||
@Unreported protected Properties properties;
|
||||
@Unreported protected File path;
|
||||
@ -70,7 +70,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
||||
properties.load(stream);
|
||||
} catch (FileNotFoundException ignored) {
|
||||
} catch (IOException e) {
|
||||
log.log(Level.WARNING, "Failed to read configuration", e);
|
||||
log.warn("Failed to read configuration", e);
|
||||
}
|
||||
|
||||
loadExtra();
|
||||
@ -131,7 +131,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
||||
try (OutputStream output = new FileOutputStream(path)) {
|
||||
properties.store(output, "Don't put comments; they get removed");
|
||||
} catch (IOException e) {
|
||||
log.log(Level.WARNING, "Failed to write configuration", e);
|
||||
log.warn("Failed to write configuration", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,11 +26,10 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.session.SessionManager;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* A less simple implementation of {@link LocalConfiguration}
|
||||
@ -51,7 +50,7 @@ public class YAMLConfiguration extends LocalConfiguration {
|
||||
try {
|
||||
config.load();
|
||||
} catch (IOException e) {
|
||||
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e);
|
||||
logger.warn("Error loading WorldEdit configuration", e);
|
||||
}
|
||||
|
||||
profile = config.getBoolean("debug", profile);
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.util.eventbus;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import com.google.common.eventbus.DeadEvent;
|
||||
import com.sk89q.worldedit.internal.annotation.RequiresNewerGuava;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
@ -36,8 +36,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Dispatches events to listeners, and provides ways for listeners to register
|
||||
@ -53,7 +53,7 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class EventBus {
|
||||
|
||||
private final Logger logger = Logger.getLogger(EventBus.class.getCanonicalName());
|
||||
private final Logger logger = LoggerFactory.getLogger(EventBus.class);
|
||||
|
||||
private final SetMultimap<Class<?>, EventHandler> handlersByType =
|
||||
Multimaps.newSetMultimap(new HashMap<>(), this::newHandlerSet);
|
||||
@ -186,8 +186,7 @@ public class EventBus {
|
||||
try {
|
||||
handler.handleEvent(event);
|
||||
} catch (InvocationTargetException e) {
|
||||
logger.log(Level.SEVERE,
|
||||
"Could not dispatch event: " + event + " to handler " + handler, e);
|
||||
logger.error("Could not dispatch event: " + event + " to handler " + handler, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,23 +19,23 @@
|
||||
|
||||
package com.sk89q.worldedit.util.io;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Throwables;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class Closer implements Closeable {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(Closer.class.getCanonicalName());
|
||||
private static final Logger logger = LoggerFactory.getLogger(Closer.class);
|
||||
|
||||
/**
|
||||
* The suppressor implementation to use for the current Java version.
|
||||
@ -218,7 +218,7 @@ public final class Closer implements Closeable {
|
||||
@Override
|
||||
public void suppress(Object closeable, Throwable thrown, Throwable suppressed) {
|
||||
// log to the same place as Closeables
|
||||
logger.log(Level.WARNING, "Suppressing exception thrown when closing " + closeable, suppressed);
|
||||
logger.warn("Suppressing exception thrown when closing " + closeable, suppressed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.logging;
|
||||
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Adds a WorldEdit prefix to WorldEdit's logger messages using a handler.
|
||||
*/
|
||||
public final class WorldEditPrefixHandler extends Handler {
|
||||
|
||||
private WorldEditPrefixHandler() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publish(LogRecord record) {
|
||||
String message = record.getMessage();
|
||||
if (!message.startsWith("WorldEdit: ") && !message.startsWith("[WorldEdit] ")) {
|
||||
record.setMessage("[WorldEdit] " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SecurityException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the handler to the following logger name.
|
||||
*
|
||||
* @param name the logger name
|
||||
*/
|
||||
public static void register(String name) {
|
||||
Logger.getLogger(name).addHandler(new WorldEditPrefixHandler());
|
||||
}
|
||||
|
||||
}
|
@ -26,14 +26,14 @@ import com.sk89q.worldedit.command.util.AsyncCommandHelper;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.command.parametric.ExceptionConverter;
|
||||
import com.sk89q.worldedit.util.task.Supervisor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ActorCallbackPaste {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(ActorCallbackPaste.class.getSimpleName());
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ActorCallbackPaste.class);
|
||||
|
||||
private ActorCallbackPaste() {
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class ActorCallbackPaste {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable throwable) {
|
||||
LOGGER.log(Level.WARNING, "Failed to submit pastebin", throwable);
|
||||
LOGGER.warn("Failed to submit pastebin", throwable);
|
||||
sender.printError("Failed to submit to a pastebin. Please see console for the error.");
|
||||
}
|
||||
});
|
||||
|
@ -19,16 +19,17 @@
|
||||
|
||||
package com.sk89q.worldedit.util.report;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class ShallowObjectReport extends DataReport {
|
||||
|
||||
private static final Logger log = Logger.getLogger(ShallowObjectReport.class.getCanonicalName());
|
||||
private static final Logger log = LoggerFactory.getLogger(ShallowObjectReport.class);
|
||||
|
||||
public ShallowObjectReport(String title, Object object) {
|
||||
super(title);
|
||||
@ -52,7 +53,7 @@ public class ShallowObjectReport extends DataReport {
|
||||
Object value = field.get(object);
|
||||
append(field.getName(), String.valueOf(value));
|
||||
} catch (IllegalAccessException e) {
|
||||
log.log(Level.WARNING, "Failed to get value of '" + field.getName() + "' on " + type);
|
||||
log.warn("Failed to get value of '" + field.getName() + "' on " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user