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

85 lines
2.4 KiB
Java
Raw Normal View History

/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
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
}
}