Switch main content to a proper logger

Need to figure out what to keep from old API and move that over as well.
This commit is contained in:
Nicholas Ignoffo 2017-08-20 16:16:13 -07:00
parent 36ce215b6b
commit acc0acb806
8 changed files with 18 additions and 17 deletions

View file

@ -29,6 +29,8 @@ import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.List;
@ -39,14 +41,15 @@ public class BloodMagic {
public static final String NAME = "Blood Magic: Alchemical Wizardry";
public static final String VERSION = "@VERSION@";
public static final String DEPEND = "required-after:guideapi;";
public static final Logger LOGGER = LogManager.getLogger(NAME.substring(0, NAME.indexOf(":")));
public static final boolean IS_DEV = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
public static final List<Pair<IBloodMagicPlugin, BloodMagicPlugin>> PLUGINS = Lists.newArrayList();
public static final CreativeTabs TAB_BM = new CreativeTabs(MODID + ".creativeTab") {
@Override
public ItemStack getTabIconItem() {
return OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_WEAK);
}
};
public static final boolean IS_DEV = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
public static final List<Pair<IBloodMagicPlugin, BloodMagicPlugin>> PLUGINS = Lists.newArrayList();
public static CreativeTabs TAB_TOMES = new CreativeTabs(MODID + ".creativeTabTome") {
@Override
public ItemStack getTabIconItem() {
@ -68,7 +71,6 @@ public class BloodMagic {
FluidRegistry.enableUniversalBucket();
}
public LogHelper logger = new LogHelper(MODID);
private File configDir;
@Mod.EventHandler

View file

@ -20,7 +20,7 @@ public class StorageBlockCraftingManager {
public void addStorageBlockRecipes() {
// this.recipes = new StorageBlockCraftingRecipeAssimilator().getPackingRecipes();
BloodMagic.instance.logger.info("Total number of compression recipes: " + this.recipes.size());
BloodMagic.LOGGER.info("Total number of compression recipes: {}", this.recipes.size());
}
public ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world) {

View file

@ -29,7 +29,7 @@ public class MeteorConfigHandler {
public static void handleMeteors(boolean checkNewVersion) {
if (meteorDir == null) {
BloodMagic.instance.logger.error("Attempted to handle meteor config but the folder has not been initialized. Was this run too early?");
BloodMagic.LOGGER.error("Attempted to handle meteor config but the folder has not been initialized. Was this run too early?");
return;
}

View file

@ -152,10 +152,9 @@ public class ClientProxy extends CommonProxy {
Map<String, RenderPlayer> skinMap = ObfuscationReflectionHelper.getPrivateValue(RenderManager.class, renderManager, "skinMap", "field_178636_l");
skinMap.get("default").addLayer(new LayerBloodElytra(skinMap.get("default")));
skinMap.get("slim").addLayer(new LayerBloodElytra(skinMap.get("slim")));
BloodMagic.instance.logger.info("Elytra layer added");
BloodMagic.LOGGER.info("Elytra layer added");
} catch (Exception e) {
BloodMagic.instance.logger.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade.");
BloodMagic.instance.logger.error(e.getLocalizedMessage());
BloodMagic.LOGGER.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade.");
}
}

View file

@ -123,7 +123,7 @@ public class ModRecipes {
CompressionRegistry.registerItemThreshold(new ItemStack(Blocks.COBBLESTONE), 64);
stopwatch.stop();
BloodMagic.instance.logger.info("Added compression recipes in {}", stopwatch);
BloodMagic.LOGGER.info("Added compression recipes in {}", stopwatch);
}
public static void addSoulForgeRecipes() {

View file

@ -120,11 +120,11 @@ public class HarvestHandlerPlantable implements IHarvestHandler {
HarvestRegistry.registerStandardCrop(crop, crop.getMaxAge());
}
} catch (NoSuchMethodException e) {
BloodMagic.instance.logger.error("HarvestCraft integration cancelled; unable to find crop name mapper");
BloodMagic.LOGGER.error("HarvestCraft integration cancelled; unable to find crop name mapper");
} catch (IllegalAccessException e) {
BloodMagic.instance.logger.error("HarvestCraft integration cancelled; crop name lookup broke");
BloodMagic.LOGGER.error("HarvestCraft integration cancelled; crop name lookup broke");
} catch (InvocationTargetException e) {
BloodMagic.instance.logger.error("HarvestCraft integration cancelled; crop name lookup broke");
BloodMagic.LOGGER.error("HarvestCraft integration cancelled; crop name lookup broke");
}
}
}

View file

@ -928,7 +928,7 @@ public class Utils {
Class<?> handlerClass = Class.forName(data.getClassName());
Object handlerImpl = handlerClass.newInstance();
MinecraftForge.EVENT_BUS.register(handlerImpl);
BloodMagic.instance.logger.debug("Registering event handler for class {}", data.getClassName());
BloodMagic.LOGGER.debug("Registering event handler for class {}", data.getClassName());
} catch (Exception e) {
// No-op
}

View file

@ -210,10 +210,10 @@ public class ClientHandler {
missingVariants.removeAll(missing);
if (errored.size() > 0)
BloodMagic.instance.logger.info("Suppressed {} model errors from Blood Magic.", errored.size());
BloodMagic.LOGGER.info("Suppressed {} model errors from Blood Magic.", errored.size());
if (missing.size() > 0)
BloodMagic.instance.logger.info("Suppressed {} variant errors from Blood Magic.", missing.size());
BloodMagic.instance.logger.debug("Suppressed discovered model/variant errors in {}", stopwatch.stop());
BloodMagic.LOGGER.info("Suppressed {} variant errors from Blood Magic.", missing.size());
BloodMagic.LOGGER.debug("Suppressed discovered model/variant errors in {}", stopwatch.stop());
}
// For some reason, we need some bad textures to be listed in the Crystal and Node models. This will hide that from the end user.
@ -246,7 +246,7 @@ public class ClientHandler {
missingTextures.keySet().remove(mc);
badTextureDomains.remove(mc);
}
BloodMagic.instance.logger.debug("Suppressed required texture errors in {}", stopwatch.stop());
BloodMagic.LOGGER.debug("Suppressed required texture errors in {}", stopwatch.stop());
}
private void renderRitualStones(EntityPlayerSP player, float partialTicks) {