Use plugin/server loggers.

This commit is contained in:
Steven Lawson 2013-08-20 20:44:39 -04:00
parent 485945047b
commit 23907ef7e4
3 changed files with 30 additions and 9 deletions

View File

@ -1,5 +1,5 @@
#Tue, 20 Aug 2013 20:00:13 -0400 #Tue, 20 Aug 2013 20:43:47 -0400
program.VERSION=3.1 program.VERSION=3.1
program.BUILDNUM=470 program.BUILDNUM=472
program.BUILDDATE=08/20/2013 08\:00 PM program.BUILDDATE=08/20/2013 08\:43 PM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Tue Aug 20 20:00:13 EDT 2013 #Tue Aug 20 20:43:47 EDT 2013
build.number=471 build.number=473

View File

@ -6,8 +6,6 @@ import org.bukkit.Bukkit;
public class TFM_Log public class TFM_Log
{ {
private static final Logger LOGGER = Bukkit.getLogger();
private TFM_Log() private TFM_Log()
{ {
throw new AssertionError(); throw new AssertionError();
@ -49,11 +47,34 @@ public class TFM_Log
private static void log(Level level, String message, boolean raw) private static void log(Level level, String message, boolean raw)
{ {
LOGGER.log(level, (raw ? "" : "[" + TotalFreedomMod.pluginName + "]: ") + message); LoggerType.getLogger(raw).log(level, message);
} }
private static void log(Level level, Throwable throwable) private static void log(Level level, Throwable throwable)
{ {
LOGGER.log(level, null, throwable); LoggerType.SERVER.getLogger().log(level, null, throwable);
}
private static enum LoggerType
{
SERVER(Bukkit.getLogger()),
PLUGIN(TotalFreedomMod.plugin.getLogger());
//
private final Logger logger;
private LoggerType(Logger logger)
{
this.logger = logger;
}
public Logger getLogger()
{
return logger;
}
public static Logger getLogger(boolean getRawLogger)
{
return (getRawLogger ? SERVER.getLogger() : PLUGIN.getLogger());
}
} }
} }