ForgePatch/src/main/java/net/minecraftforge/fml/common/FMLLog.java

92 lines
2.7 KiB
Java
Raw Normal View History

/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library 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 version 2.1
* of the License.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
2014-09-23 05:01:24 +00:00
package net.minecraftforge.fml.common;
2012-07-23 19:03:17 +00:00
2013-12-16 16:47:48 +00:00
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
2012-07-23 19:03:17 +00:00
@SuppressWarnings("static-access")
2012-07-23 19:03:17 +00:00
public class FMLLog
{
2014-09-23 05:01:24 +00:00
private static net.minecraftforge.fml.relauncher.FMLRelaunchLog coreLog = net.minecraftforge.fml.relauncher.FMLRelaunchLog.log;
2012-07-23 19:03:17 +00:00
2013-12-16 16:47:48 +00:00
public static void log(String targetLog, Level level, String format, Object... data)
{
2013-12-16 16:47:48 +00:00
coreLog.log(targetLog, level, format, data);
}
2012-07-23 19:03:17 +00:00
public static void log(Level level, String format, Object... data)
{
coreLog.log(level, format, data);
2012-07-23 19:03:17 +00:00
}
2013-12-16 16:47:48 +00:00
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data)
{
2013-12-16 16:47:48 +00:00
coreLog.log(targetLog, level, ex, format, data);
}
2012-07-23 19:03:17 +00:00
public static void log(Level level, Throwable ex, String format, Object... data)
{
coreLog.log(level, ex, format, data);
2012-07-23 19:03:17 +00:00
}
2012-07-23 19:03:17 +00:00
public static void severe(String format, Object... data)
{
2013-12-16 16:47:48 +00:00
log(Level.ERROR, format, data);
2012-07-23 19:03:17 +00:00
}
public static void bigWarning(String format, Object... data)
{
2014-04-22 23:49:07 +00:00
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
log(Level.WARN, "****************************************");
log(Level.WARN, "* "+format, data);
2014-04-22 23:49:07 +00:00
for (int i = 2; i < 8 && i < trace.length; i++)
{
log(Level.WARN, "* at %s%s", trace[i].toString(), i == 7 ? "..." : "");
}
log(Level.WARN, "****************************************");
}
2012-07-23 19:03:17 +00:00
public static void warning(String format, Object... data)
{
2013-12-16 16:47:48 +00:00
log(Level.WARN, format, data);
2012-07-23 19:03:17 +00:00
}
public static void info(String format, Object... data)
{
log(Level.INFO, format, data);
}
public static void fine(String format, Object... data)
{
2013-12-16 16:47:48 +00:00
log(Level.DEBUG, format, data);
2012-07-23 19:03:17 +00:00
}
public static void finer(String format, Object... data)
{
2013-12-16 16:47:48 +00:00
log(Level.TRACE, format, data);
2012-07-23 19:03:17 +00:00
}
public static Logger getLogger()
2012-07-23 19:03:17 +00:00
{
return coreLog.getLogger();
2012-07-23 19:03:17 +00:00
}
}