Commit e7914a05d674a8f63d3104f3749bb504d401b386
1 parent
67d33bd9
prettier logging from BeforeInvoke
Showing
2 changed files
with
16 additions
and
5 deletions
java/common/com/mumfrey/liteloader/transformers/event/inject/BeforeInvoke.java
| @@ -187,9 +187,10 @@ public class BeforeInvoke extends InjectionPoint | @@ -187,9 +187,10 @@ public class BeforeInvoke extends InjectionPoint | ||
| 187 | } | 187 | } |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | - public void setLogging(boolean logging) | 190 | + public BeforeInvoke setLogging(boolean logging) |
| 191 | { | 191 | { |
| 192 | this.logging = logging; | 192 | this.logging = logging; |
| 193 | + return this; | ||
| 193 | } | 194 | } |
| 194 | 195 | ||
| 195 | /* (non-Javadoc) | 196 | /* (non-Javadoc) |
| @@ -200,6 +201,12 @@ public class BeforeInvoke extends InjectionPoint | @@ -200,6 +201,12 @@ public class BeforeInvoke extends InjectionPoint | ||
| 200 | { | 201 | { |
| 201 | int ordinal = 0; | 202 | int ordinal = 0; |
| 202 | boolean found = false; | 203 | boolean found = false; |
| 204 | + | ||
| 205 | + if (this.logging) | ||
| 206 | + { | ||
| 207 | + LiteLoaderLogger.debug("================================================================================"); | ||
| 208 | + LiteLoaderLogger.debug("BeforeInvoke is searching for an injection point in method with descriptor %s", desc); | ||
| 209 | + } | ||
| 203 | 210 | ||
| 204 | ListIterator<AbstractInsnNode> iter = insns.iterator(); | 211 | ListIterator<AbstractInsnNode> iter = insns.iterator(); |
| 205 | while (iter.hasNext()) | 212 | while (iter.hasNext()) |
| @@ -210,19 +217,19 @@ public class BeforeInvoke extends InjectionPoint | @@ -210,19 +217,19 @@ public class BeforeInvoke extends InjectionPoint | ||
| 210 | { | 217 | { |
| 211 | MethodInsnNode node = (MethodInsnNode)insn; | 218 | MethodInsnNode node = (MethodInsnNode)insn; |
| 212 | 219 | ||
| 213 | - if (this.logging) LiteLoaderLogger.info("BeforeInvoke is considering invokation NAME=" + node.name + " DESC=" + node.desc + " OWNER=" + node.owner); | 220 | + if (this.logging) LiteLoaderLogger.debug("BeforeInvoke is considering invokation NAME=%s DESC=%s OWNER=%s", node.name, node.desc, node.owner); |
| 214 | 221 | ||
| 215 | int index = BeforeInvoke.arrayIndexOf(this.methodNames, node.name, -1); | 222 | int index = BeforeInvoke.arrayIndexOf(this.methodNames, node.name, -1); |
| 216 | - if (index > -1 && this.logging) LiteLoaderLogger.info("BeforeInvoke found a matching invoke, checking owner/signature..."); | 223 | + if (index > -1 && this.logging) LiteLoaderLogger.debug("BeforeInvoke found a matching invoke, checking owner/signature..."); |
| 217 | 224 | ||
| 218 | int ownerIndex = BeforeInvoke.arrayIndexOf(this.methodOwners, node.owner, index); | 225 | int ownerIndex = BeforeInvoke.arrayIndexOf(this.methodOwners, node.owner, index); |
| 219 | int descIndex = BeforeInvoke.arrayIndexOf(this.methodSignatures, node.desc, index); | 226 | int descIndex = BeforeInvoke.arrayIndexOf(this.methodSignatures, node.desc, index); |
| 220 | if (index > -1 && ownerIndex == index && descIndex == index) | 227 | if (index > -1 && ownerIndex == index && descIndex == index) |
| 221 | { | 228 | { |
| 222 | - if (this.logging) LiteLoaderLogger.info("BeforeInvoke found a matching invoke, checking ordinal..."); | 229 | + if (this.logging) LiteLoaderLogger.debug("BeforeInvoke found a matching invoke, checking preconditions..."); |
| 223 | if (this.matchesInsn(node, ordinal)) | 230 | if (this.matchesInsn(node, ordinal)) |
| 224 | { | 231 | { |
| 225 | - if (this.logging) LiteLoaderLogger.info("BeforeInvoke found a matching invoke at ordinal %d", ordinal); | 232 | + if (this.logging) LiteLoaderLogger.debug("BeforeInvoke found a matching invoke at ordinal %d", ordinal); |
| 226 | nodes.add(node); | 233 | nodes.add(node); |
| 227 | found = true; | 234 | found = true; |
| 228 | 235 | ||
| @@ -237,6 +244,8 @@ public class BeforeInvoke extends InjectionPoint | @@ -237,6 +244,8 @@ public class BeforeInvoke extends InjectionPoint | ||
| 237 | this.inspectInsn(desc, insns, insn); | 244 | this.inspectInsn(desc, insns, insn); |
| 238 | } | 245 | } |
| 239 | 246 | ||
| 247 | + if (this.logging) LiteLoaderLogger.debug("================================================================================"); | ||
| 248 | + | ||
| 240 | return found; | 249 | return found; |
| 241 | } | 250 | } |
| 242 | 251 | ||
| @@ -247,6 +256,7 @@ public class BeforeInvoke extends InjectionPoint | @@ -247,6 +256,7 @@ public class BeforeInvoke extends InjectionPoint | ||
| 247 | 256 | ||
| 248 | protected boolean matchesInsn(MethodInsnNode node, int ordinal) | 257 | protected boolean matchesInsn(MethodInsnNode node, int ordinal) |
| 249 | { | 258 | { |
| 259 | + if (this.logging) LiteLoaderLogger.debug("BeforeInvoke comparing target ordinal %d with current ordinal %d", this.ordinal, ordinal); | ||
| 250 | return this.ordinal == -1 || this.ordinal == ordinal; | 260 | return this.ordinal == -1 || this.ordinal == ordinal; |
| 251 | } | 261 | } |
| 252 | 262 |
java/common/com/mumfrey/liteloader/transformers/event/inject/BeforeStringInvoke.java
| @@ -67,6 +67,7 @@ public class BeforeStringInvoke extends BeforeInvoke | @@ -67,6 +67,7 @@ public class BeforeStringInvoke extends BeforeInvoke | ||
| 67 | @Override | 67 | @Override |
| 68 | protected boolean matchesInsn(MethodInsnNode node, int ordinal) | 68 | protected boolean matchesInsn(MethodInsnNode node, int ordinal) |
| 69 | { | 69 | { |
| 70 | + if (this.logging) LiteLoaderLogger.debug("BeforeInvoke foundLdc \"%s\" = %s", this.ldcValue, this.foundLdc); | ||
| 70 | return this.foundLdc && super.matchesInsn(node, ordinal); | 71 | return this.foundLdc && super.matchesInsn(node, ordinal); |
| 71 | } | 72 | } |
| 72 | } | 73 | } |