Fixed logging better
This commit is contained in:
parent
5e7897bb50
commit
bbf30b5da3
|
|
@ -1,40 +1,25 @@
|
|||
package com.alttd.boosterapi.util;
|
||||
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ALogger {
|
||||
|
||||
private static org.slf4j.Logger velocityLogger = null;
|
||||
private static Logger bukkitLogger = null;
|
||||
private static org.slf4j.Logger logger = null;
|
||||
|
||||
public static void init(org.slf4j.Logger log) {
|
||||
velocityLogger = log;
|
||||
}
|
||||
|
||||
public static void init(Logger log) {
|
||||
bukkitLogger = log;
|
||||
logger = log;
|
||||
}
|
||||
|
||||
public static void warn(String message) {
|
||||
if (velocityLogger != null)
|
||||
velocityLogger.warn(message);
|
||||
if (bukkitLogger != null)
|
||||
bukkitLogger.warning(message);
|
||||
logger.warn(message);
|
||||
}
|
||||
|
||||
public static void info(String message) {
|
||||
if (velocityLogger != null)
|
||||
velocityLogger.info(message);
|
||||
if (bukkitLogger != null)
|
||||
bukkitLogger.info(message);
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
public static void error(String message) {
|
||||
if (velocityLogger != null)
|
||||
velocityLogger.error(message);
|
||||
if (bukkitLogger != null)
|
||||
bukkitLogger.severe(message);
|
||||
logger.error(message);
|
||||
}
|
||||
|
||||
public static void fatal(String error, Exception exception) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public final class BoostersPlugin extends JavaPlugin {
|
|||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
ALogger.init(Bukkit.getLogger());
|
||||
ALogger.init(getSLF4JLogger());
|
||||
boosterAPI = new BoosterImplementation();
|
||||
boosterManager = new BoosterManager();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user