Disable verbose logging by default

This commit is contained in:
Mumfrey committed 2015-02-22 21:35:22 +00:00
1 parent 55653f325d
commit e88f5b72ee
3 files changed
+27 -2

No files matched your search

@@ -34,8 +34,10 @@ import java.util.Set;
import net.minecraft.launchwrapper.Launch;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.helpers.Booleans;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.injection.struct.ReferenceMapper;
@@ -114,6 +116,12 @@ class MixinConfig implements Comparable<MixinConfig> {
@SerializedName("refmap")
private String refMapperConfig;
/**
* True to output "mixing in" messages at INFO level rather than DEBUG
*/
@SerializedName("verbose")
private boolean verboseLogging;
/**
* Intrinsic order (for sorting configurations with identical priority)
*/
@@ -185,6 +193,7 @@ class MixinConfig implements Comparable<MixinConfig> {
}
this.refMapper = ReferenceMapper.read(this.refMapperConfig);
this.verboseLogging |= Booleans.parseBoolean(System.getProperty("mixin.debug.verbose"), false) | MixinTransformer.DEBUG_ALL;
}
/**
@@ -304,6 +313,13 @@ class MixinConfig implements Comparable<MixinConfig> {
public Set<String> getTargets() {
return this.mixinMapping.keySet();
}
/**
* Get the logging level for this config
*/
public Level getLoggingLevel() {
return this.verboseLogging ? Level.INFO : Level.DEBUG;
}
/**
* Check whether this configuration bundle has a mixin for the specified
@@ -36,6 +36,7 @@ import java.util.Set;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.objectweb.asm.ClassReader;
@@ -427,6 +428,13 @@ class MixinInfo extends TreeInfo implements Comparable<MixinInfo>, IMixinInfo {
return this.detachedSuper;
}
/**
* Get the logging level for this mixin
*/
public Level getLoggingLevel() {
return this.parent.getLoggingLevel();
}
/**
* Get a new tree for the class bytecode
*/
@@ -158,7 +158,8 @@ public class MixinTransformer extends TreeTransformer {
Opcodes.SASTORE
};
private static final boolean DEBUG_EXPORT = Booleans.parseBoolean(System.getProperty("mixin.debug.export"), false);
public static final boolean DEBUG_ALL = Booleans.parseBoolean(System.getProperty("mixin.debug"), false);
private static final boolean DEBUG_EXPORT = Booleans.parseBoolean(System.getProperty("mixin.debug.export"), false) | MixinTransformer.DEBUG_ALL;
/**
* Log all the things
@@ -348,7 +349,7 @@ public class MixinTransformer extends TreeTransformer {
ClassNode targetClass = this.readClass(basicClass, true);
for (MixinInfo mixin : mixins) {
this.logger.info("Mixing {} into {}", mixin.getName(), transformedName);
this.logger.log(mixin.getLoggingLevel(), "Mixing {} into {}", mixin.getName(), transformedName);
this.applyMixin(transformedName, targetClass, mixin.createContextForTarget(targetClass));
}