2013-03-08 00:25:48 +00:00
|
|
|
/*
|
2016-06-23 03:49:47 +00:00
|
|
|
* Minecraft Forge
|
2018-07-01 21:17:28 +00:00
|
|
|
* Copyright (c) 2016-2018.
|
2013-11-10 16:49:06 +00:00
|
|
|
*
|
2016-06-23 03:49:47 +00:00
|
|
|
* 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
|
2013-03-08 00:25:48 +00:00
|
|
|
*/
|
|
|
|
|
2014-09-23 05:01:24 +00:00
|
|
|
package net.minecraftforge.fml.common;
|
2012-07-23 19:03:17 +00:00
|
|
|
|
2018-06-21 19:37:32 +00:00
|
|
|
import java.util.Locale;
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
2018-06-21 19:37:32 +00:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
2017-06-23 05:33:11 +00:00
|
|
|
|
2013-12-16 16:47:48 +00:00
|
|
|
import org.apache.logging.log4j.Level;
|
2017-06-23 05:33:11 +00:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
2013-12-16 16:47:48 +00:00
|
|
|
import org.apache.logging.log4j.Logger;
|
2018-06-21 19:37:32 +00:00
|
|
|
import org.apache.logging.log4j.ThreadContext;
|
2012-07-23 19:03:17 +00:00
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
/**
|
|
|
|
* FMLs logging class. <b>Internal use only, NOT FOR MOD LOGGING!</b> Mods use your own log, see {@link FMLPreInitializationEvent#getModLog()}.
|
2018-03-18 01:41:16 +00:00
|
|
|
* TODO 1.13 remove all the deprecated methods
|
2017-06-23 05:33:11 +00:00
|
|
|
*/
|
2012-07-23 19:03:17 +00:00
|
|
|
public class FMLLog
|
|
|
|
{
|
|
|
|
|
2018-03-18 01:41:16 +00:00
|
|
|
public static final Logger log = LogManager.getLogger("FML");
|
2017-06-23 05:33:11 +00:00
|
|
|
|
|
|
|
public static void bigWarning(String format, Object... data)
|
|
|
|
{
|
|
|
|
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
|
|
|
|
log.warn("****************************************");
|
|
|
|
log.warn("* "+format, data);
|
|
|
|
for (int i = 2; i < 8 && i < trace.length; i++)
|
|
|
|
{
|
|
|
|
log.warn("* at {}{}", trace[i].toString(), i == 7 ? "..." : "");
|
|
|
|
}
|
|
|
|
log.warn("****************************************");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Deprecated
|
2013-12-16 16:47:48 +00:00
|
|
|
public static void log(String targetLog, Level level, String format, Object... data)
|
2013-01-30 23:57:21 +00:00
|
|
|
{
|
2017-06-23 05:33:11 +00:00
|
|
|
FMLRelaunchLog.log(targetLog, level, format, data);
|
2013-01-30 23:57:21 +00:00
|
|
|
}
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
2012-07-23 19:03:17 +00:00
|
|
|
public static void log(Level level, String format, Object... data)
|
|
|
|
{
|
2017-06-23 05:33:11 +00:00
|
|
|
FMLRelaunchLog.log(level, format, data);
|
2012-07-23 19:03:17 +00:00
|
|
|
}
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
2013-12-16 16:47:48 +00:00
|
|
|
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data)
|
2013-01-30 23:57:21 +00:00
|
|
|
{
|
2017-06-23 05:33:11 +00:00
|
|
|
FMLRelaunchLog.log(targetLog, level, ex, format, data);
|
2013-01-30 23:57:21 +00:00
|
|
|
}
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
2012-07-23 19:03:17 +00:00
|
|
|
public static void log(Level level, Throwable ex, String format, Object... data)
|
|
|
|
{
|
2017-06-23 05:33:11 +00:00
|
|
|
FMLRelaunchLog.log(level, ex, format, data);
|
2012-07-23 19:03:17 +00:00
|
|
|
}
|
2012-07-30 02:54:59 +00:00
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
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
|
|
|
}
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
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
|
|
|
}
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
2012-07-23 19:03:17 +00:00
|
|
|
public static void info(String format, Object... data)
|
|
|
|
{
|
|
|
|
log(Level.INFO, format, data);
|
|
|
|
}
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
2012-07-23 19:03:17 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
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
|
|
|
}
|
|
|
|
|
2017-06-23 05:33:11 +00:00
|
|
|
@Deprecated
|
2012-07-30 02:54:59 +00:00
|
|
|
public static Logger getLogger()
|
2012-07-23 19:03:17 +00:00
|
|
|
{
|
2017-06-23 05:33:11 +00:00
|
|
|
return log;
|
2012-07-23 19:03:17 +00:00
|
|
|
}
|
|
|
|
}
|