Big cleanup of logging. Might do some tweaks of the userdev logging, but this should be good for vanilla..

Signed-off-by: cpw <[email protected]>
This commit is contained in:
cpw committed 2019-01-26 22:18:28 -05:00
1 parent 7d21e5d328
commit 3c55b46ca0
9 files changed
+46 -22

No files matched your search

@@ -45,6 +45,10 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
*/
public static class NewRegistry extends net.minecraftforge.eventbus.api.Event
{
@Override
public String toString() {
return "RegistryEvent.NewRegistry";
}
}
/**
@@ -80,6 +84,10 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
return name;
}
@Override
public String toString() {
return "RegistryEvent.Register<"+getName()+">";
}
}
public static class MissingMappings<T extends IForgeRegistryEntry<T>> extends RegistryEvent<T>
@@ -66,7 +66,7 @@ public class AutomaticEventSubscriber
if (Objects.equals(mod.getModId(), modId) && sides.contains(FMLEnvironment.dist)) {
try
{
LOGGER.info(LOADING, "Auto-subscribing {} to {}", ad.getClassType().getClassName(), busTarget);
LOGGER.debug(LOADING, "Auto-subscribing {} to {}", ad.getClassType().getClassName(), busTarget);
busTarget.bus().get().register(Class.forName(ad.getClassType().getClassName(), true, loader));
}
catch (ClassNotFoundException e)
@@ -37,15 +37,15 @@ public class LaunchTesting
public static void main(String... args) throws InterruptedException
{
Configurator.setRootLevel(Level.DEBUG);
final MarkerFilter classloadingFilter = MarkerFilter.createFilter("CLASSLOADING", Filter.Result.DENY, Filter.Result.NEUTRAL);
final MarkerFilter launchpluginFilter = MarkerFilter.createFilter("LAUNCHPLUGIN", Filter.Result.DENY, Filter.Result.NEUTRAL);
// final MarkerFilter classloadingFilter = MarkerFilter.createFilter("CLASSLOADING", Filter.Result.DENY, Filter.Result.NEUTRAL);
// final MarkerFilter launchpluginFilter = MarkerFilter.createFilter("LAUNCHPLUGIN", Filter.Result.DENY, Filter.Result.NEUTRAL);
final MarkerFilter axformFilter= MarkerFilter.createFilter("AXFORM", Filter.Result.DENY, Filter.Result.NEUTRAL);
final MarkerFilter eventbusFilter = MarkerFilter.createFilter("EVENTBUS", Filter.Result.DENY, Filter.Result.NEUTRAL);
final MarkerFilter distxformFilter = MarkerFilter.createFilter("DISTXFORM", Filter.Result.DENY, Filter.Result.NEUTRAL);
// final MarkerFilter scannerFilter = MarkerFilter.createFilter("SCAN", Filter.Result.DENY, Filter.Result.NEUTRAL);
final LoggerContext logcontext = LoggerContext.getContext(false);
logcontext.getConfiguration().addFilter(classloadingFilter);
logcontext.getConfiguration().addFilter(launchpluginFilter);
// logcontext.getConfiguration().addFilter(classloadingFilter);
// logcontext.getConfiguration().addFilter(launchpluginFilter);
// logcontext.getConfiguration().addFilter(axformFilter);
// logcontext.getConfiguration().addFilter(eventbusFilter);
// logcontext.getConfiguration().addFilter(distxformFilter);
@@ -94,13 +94,13 @@ public class ModList
}
private void dispatchSynchronousEvent(LifecycleEventProvider.LifecycleEvent lifecycleEvent, final Consumer<List<ModLoadingException>> errorHandler) {
LOGGER.info(LOADING, "Dispatching synchronous event {}", lifecycleEvent);
LOGGER.debug(LOADING, "Dispatching synchronous event {}", lifecycleEvent);
FMLLoader.getLanguageLoadingProvider().forEach(lp->lp.consumeLifecycleEvent(()->lifecycleEvent));
this.mods.forEach(m->m.transitionState(lifecycleEvent, errorHandler));
FMLLoader.getLanguageLoadingProvider().forEach(lp->lp.consumeLifecycleEvent(()->lifecycleEvent));
}
private void dispatchParallelEvent(LifecycleEventProvider.LifecycleEvent lifecycleEvent, final Consumer<List<ModLoadingException>> errorHandler) {
LOGGER.info(LOADING, "Dispatching parallel event {}", lifecycleEvent);
LOGGER.debug(LOADING, "Dispatching parallel event {}", lifecycleEvent);
FMLLoader.getLanguageLoadingProvider().forEach(lp->lp.consumeLifecycleEvent(()->lifecycleEvent));
DeferredWorkQueue.clear();
try
@@ -23,6 +23,7 @@ import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.ModContainer;
import java.util.Arrays;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -42,7 +43,7 @@ public class ModLifecycleEvent extends Event
public final String description()
{
String cn = getClass().getName();
return cn.substring(cn.lastIndexOf('.')+4,cn.length()-5);
return cn.substring(cn.lastIndexOf('.')+1);
}
public Stream<InterModComms.IMCMessage> getIMCStream() {
@@ -52,4 +53,9 @@ public class ModLifecycleEvent extends Event
public Stream<InterModComms.IMCMessage> getIMCStream(Predicate<String> methodFilter) {
return InterModComms.getMessages(this.container.getModId(), methodFilter);
}
@Override
public String toString() {
return description();
}
}
@@ -98,11 +98,11 @@ public class FMLModContainer extends ModContainer
private void fireEvent(LifecycleEventProvider.LifecycleEvent lifecycleEvent) {
final Event event = lifecycleEvent.getOrBuildEvent(this);
LOGGER.info(LOADING, "Firing event for modid {} : {}", this.getModId(), event.getClass().getName());
LOGGER.debug(LOADING, "Firing event for modid {} : {}", this.getModId(), event);
try
{
eventBus.post(event);
LOGGER.debug(LOADING, "Fired event for modid {} : {}", this.getModId(), event.getClass().getName());
LOGGER.debug(LOADING, "Fired event for modid {} : {}", this.getModId(), event);
}
catch (Throwable e)
{
@@ -65,6 +65,8 @@ import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static net.minecraftforge.fml.Logging.CORE;
/**
* INTERNAL ONLY
* MODDERS SHOULD HAVE NO REASON TO USE THIS CLASS
@@ -809,9 +811,9 @@ public class GameData
if (i==keysSize-1) lifecycleEventProvider.changeProgression(LifecycleEventProvider.LifecycleEvent.Progression.NEXT);
eventDispatcher.accept(lifecycleEventProvider);
reg.freeze();
LOGGER.info("{} Applying holder lookups", rl.toString());
LOGGER.debug(CORE,"Applying holder lookups: {}", rl.toString());
ObjectHolderRegistry.applyObjectHolders(rl::equals);
LOGGER.info("{} Holder lookups applied", rl.toString());
LOGGER.debug(CORE,"Holder lookups applied: {}", rl.toString());
}
}
@@ -45,6 +45,8 @@ import org.apache.logging.log4j.Logger;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import static net.minecraftforge.fml.Logging.CORE;
/**
* Internal registry for tracking {@link ObjectHolder} references
*/
@@ -87,7 +89,7 @@ public class ObjectHolderRegistry
public static void findObjectHolders()
{
LOGGER.info("Processing ObjectHolder annotations");
LOGGER.debug(CORE,"Processing ObjectHolder annotations");
final List<ModFileScanData.AnnotationData> annotations = ModList.get().getAllScanData().stream()
.map(ModFileScanData::getAnnotations)
.flatMap(Collection::stream)