Got rid of varargs in logger, possible cause of exceptions.

This commit is contained in:
Steven Lawson 2013-08-22 16:56:17 -04:00
parent 6ba8dcaa58
commit 10f905ea36
3 changed files with 42 additions and 27 deletions

View File

@ -1,5 +1,5 @@
#Tue, 20 Aug 2013 20:43:47 -0400 #Thu, 22 Aug 2013 16:55:02 -0400
program.VERSION=3.1 program.VERSION=3.1
program.BUILDNUM=472 program.BUILDNUM=473
program.BUILDDATE=08/20/2013 08\:43 PM program.BUILDDATE=08/22/2013 04\:55 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:43:47 EDT 2013 #Thu Aug 22 16:55:02 EDT 2013
build.number=473 build.number=474

View File

@ -14,40 +14,55 @@ public class TFM_Log
throw new AssertionError(); throw new AssertionError();
} }
public static void info(Object... params) //Level.INFO:
public static void info(String message)
{ {
prepareLogMessage(Level.INFO, params); info(message, false);
} }
public static void warning(Object... params) public static void info(String message, Boolean raw)
{ {
prepareLogMessage(Level.WARNING, params); log(Level.INFO, message, raw);
} }
public static void severe(Object... params) public static void info(Throwable ex)
{ {
prepareLogMessage(Level.SEVERE, params); log(Level.INFO, ex);
} }
private static void prepareLogMessage(Level level, Object... params) //Level.WARNING:
public static void warning(String message)
{ {
if (params.length == 0) info(message, false);
{
return;
}
Object payload = params[0];
if (payload instanceof Throwable)
{
log(level, (Throwable) payload);
}
else
{
log(level, payload.toString(), params.length >= 2 && params[1] instanceof Boolean ? (Boolean) params[1] : false);
}
} }
public static void warning(String message, Boolean raw)
{
log(Level.WARNING, message, raw);
}
public static void warning(Throwable ex)
{
log(Level.WARNING, ex);
}
//Level.SEVERE:
public static void severe(String message)
{
info(message, false);
}
public static void severe(String message, Boolean raw)
{
log(Level.SEVERE, message, raw);
}
public static void severe(Throwable ex)
{
log(Level.SEVERE, ex);
}
//Utility
private static void log(Level level, String message, boolean raw) private static void log(Level level, String message, boolean raw)
{ {
getLogger(raw).log(level, message); getLogger(raw).log(level, message);