Add debug config option to log all TRACE level events to INFO (if you ONLY want to see EE3 related TRACE stuff developers, enable this)

This commit is contained in:
Pahimar 2015-05-29 19:47:51 -04:00
parent a48196b580
commit f4cc4fb108
5 changed files with 25 additions and 2 deletions

View File

@ -15,11 +15,13 @@ public class ConfigurationHandler
{
public static Configuration configuration;
private final static String CATEGORY_DEBUG = "general.Debug";
public static void init(File configFile)
{
if (configuration == null)
{
configuration = new Configuration(configFile);
configuration = new Configuration(configFile, true);
loadConfiguration();
}
}
@ -31,6 +33,7 @@ public class ConfigurationHandler
Settings.Sounds.soundMode = ConfigurationHelper.getString(configuration, Messages.Configuration.SOUND_MODE, Configuration.CATEGORY_GENERAL, "All", StatCollector.translateToLocal(Messages.Configuration.SOUND_MODE_COMMENT), new String[]{"All", "Self", "None"}, Messages.Configuration.SOUND_MODE_LABEL);
Settings.Abilities.onlyLoadFile = configuration.getBoolean(Messages.Configuration.ABILITIES_ONLY_LOAD_FILE, Configuration.CATEGORY_GENERAL, false, StatCollector.translateToLocal(Messages.Configuration.ABILITIES_ONLY_LOAD_FILE_COMMENT), Messages.Configuration.ABILITIES_ONLY_LOAD_FILE_LABEL);
Settings.DynamicEnergyValueGeneration.regenerateEnergyValuesWhen = ConfigurationHelper.getString(configuration, Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN, Configuration.CATEGORY_GENERAL, "When Mods Change", StatCollector.translateToLocal(Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN_COMMENT), new String[]{"Never", "When Mods Change", "Always"}, Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN_LABEL);
Settings.Debug.logTraceToInfo = configuration.getBoolean(Messages.Configuration.LOG_TRACE_TO_INFO, CATEGORY_DEBUG, false, StatCollector.translateToLocal(Messages.Configuration.LOG_TRACE_TO_INFO_COMMENT), Messages.Configuration.LOG_TRACE_TO_INFO_LABEL);
if (configuration.hasChanged())
{

View File

@ -123,5 +123,9 @@ public final class Messages
public static final String REGENERATE_ENERGYVALUES_WHEN = "energyvalues.regenerateEnergyValuesWhen";
public static final String REGENERATE_ENERGYVALUES_WHEN_LABEL = "general.energyvalues.regenerateEnergyValuesWhen.label";
public static final String REGENERATE_ENERGYVALUES_WHEN_COMMENT = "general.energyvalues.regenerateEnergyValuesWhen.comment";
public static final String LOG_TRACE_TO_INFO = "debug.logTraceToInfo";
public static final String LOG_TRACE_TO_INFO_LABEL = "debug.logTraceToInfo.label";
public static final String LOG_TRACE_TO_INFO_COMMENT = "debug.logTraceToInfo.comment";
}
}

View File

@ -21,4 +21,9 @@ public class Settings
{
public static String regenerateEnergyValuesWhen;
}
public static class Debug
{
public static boolean logTraceToInfo;
}
}

View File

@ -1,6 +1,7 @@
package com.pahimar.ee3.util;
import com.pahimar.ee3.reference.Reference;
import com.pahimar.ee3.reference.Settings;
import cpw.mods.fml.common.FMLLog;
import org.apache.logging.log4j.Level;
@ -43,7 +44,14 @@ public class LogHelper
public static void trace(Object object)
{
log(Level.TRACE, object);
if (!Settings.Debug.logTraceToInfo)
{
log(Level.TRACE, object);
}
else
{
log(Level.INFO, object);
}
}
public static void warn(Object object)

View File

@ -11,6 +11,9 @@ general.abilities.onlyLoadFile.comment=Setting this to true means that Abilities
general.energyvalues.regenerateEnergyValuesWhen.label=Regenerate EnergyValues
general.energyvalues.regenerateEnergyValuesWhen.comment=When to regenerate EnergyValues. Options are "Always" (every time Minecraft starts), "When Mods Change" (when mods are added, removed, or updated) or "Never" (only generate the first time).
debug.logTraceToInfo.label=Log TRACE to INFO
debug.logTraceToInfo.comment=Whether or not to log TRACE level logging events to INFO
# Keys
key.categories.ee3=Equivalent Exchange 3
key.charge=Charge