mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
More logger tweaks.
This commit is contained in:
parent
75ec2330f5
commit
485945047b
@ -1,5 +1,5 @@
|
|||||||
#Tue, 20 Aug 2013 17:31:27 +0200
|
#Tue, 20 Aug 2013 20:00:13 -0400
|
||||||
|
|
||||||
program.VERSION=3.1
|
program.VERSION=3.1
|
||||||
program.BUILDNUM=469
|
program.BUILDNUM=470
|
||||||
program.BUILDDATE=08/20/2013 05\:31 PM
|
program.BUILDDATE=08/20/2013 08\:00 PM
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Tue Aug 20 17:31:27 CEST 2013
|
#Tue Aug 20 20:00:13 EDT 2013
|
||||||
build.number=470
|
build.number=471
|
||||||
|
@ -1,56 +1,59 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
public class TFM_Log
|
public class TFM_Log
|
||||||
{
|
{
|
||||||
private static final Logger logger = Bukkit.getLogger();
|
private static final Logger LOGGER = Bukkit.getLogger();
|
||||||
|
|
||||||
private TFM_Log()
|
private TFM_Log()
|
||||||
{
|
{
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(String message)
|
public static void info(Object... params)
|
||||||
{
|
{
|
||||||
TotalFreedomMod.logger.info(message);
|
prepareLogMessage(Level.INFO, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(String message, boolean raw)
|
public static void warning(Object... params)
|
||||||
{
|
{
|
||||||
if (raw)
|
prepareLogMessage(Level.WARNING, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void severe(Object... params)
|
||||||
|
{
|
||||||
|
prepareLogMessage(Level.SEVERE, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void prepareLogMessage(Level level, Object... params)
|
||||||
|
{
|
||||||
|
if (params.length == 0)
|
||||||
{
|
{
|
||||||
TotalFreedomMod.logger.info(message);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object payload = params[0];
|
||||||
|
|
||||||
|
if (payload instanceof Throwable)
|
||||||
|
{
|
||||||
|
log(level, (Throwable) payload);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info(message);
|
log(level, payload.toString(), params.length >= 2 && params[1] instanceof Boolean ? (Boolean) params[1] : false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void severe(Object message)
|
private static void log(Level level, String message, boolean raw)
|
||||||
{
|
{
|
||||||
if (message instanceof Throwable)
|
LOGGER.log(level, (raw ? "" : "[" + TotalFreedomMod.pluginName + "]: ") + message);
|
||||||
{
|
|
||||||
TotalFreedomMod.logger.severe(ExceptionUtils.getFullStackTrace((Throwable) message));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.logger.severe(String.valueOf(message));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warning(Object message)
|
private static void log(Level level, Throwable throwable)
|
||||||
{
|
{
|
||||||
if (message instanceof Throwable)
|
LOGGER.log(level, null, throwable);
|
||||||
{
|
|
||||||
TotalFreedomMod.logger.warning(ExceptionUtils.getFullStackTrace((Throwable) message));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.logger.warning(String.valueOf(message));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public static TotalFreedomMod plugin = null;
|
public static TotalFreedomMod plugin = null;
|
||||||
public static File plugin_file = null;
|
public static File plugin_file = null;
|
||||||
//
|
//
|
||||||
public static Logger logger;
|
|
||||||
//
|
|
||||||
public static String pluginName = "";
|
public static String pluginName = "";
|
||||||
public static String pluginVersion = "";
|
public static String pluginVersion = "";
|
||||||
public static String buildNumber = "";
|
public static String buildNumber = "";
|
||||||
@ -69,14 +67,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
TotalFreedomMod.plugin = this;
|
TotalFreedomMod.plugin = this;
|
||||||
TotalFreedomMod.plugin_file = plugin.getFile();
|
TotalFreedomMod.plugin_file = plugin.getFile();
|
||||||
TotalFreedomMod.logger = plugin.getLogger();
|
|
||||||
|
|
||||||
TotalFreedomMod.pluginName = plugin.getDescription().getName();
|
TotalFreedomMod.pluginName = plugin.getDescription().getName();
|
||||||
|
|
||||||
setAppProperties();
|
setAppProperties();
|
||||||
|
|
||||||
logger = plugin.getLogger();
|
|
||||||
|
|
||||||
TFM_Log.info("Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
|
TFM_Log.info("Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
|
||||||
|
|
||||||
loadSuperadminConfig();
|
loadSuperadminConfig();
|
||||||
@ -162,16 +156,16 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TFM_CommandBlocker.getInstance().parseBlockingRules();
|
TFM_CommandBlocker.getInstance().parseBlockingRules();
|
||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 20L);
|
}.runTaskLater(plugin, 20L);
|
||||||
|
|
||||||
|
TFM_Log.info("Plugin enabled.");
|
||||||
TFM_Log.info("Plugin enabled");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
server.getScheduler().cancelTasks(plugin);
|
server.getScheduler().cancelTasks(plugin);
|
||||||
TFM_Log.info("Plugin disabled");
|
|
||||||
|
TFM_Log.info("Plugin disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user