changeset 575:e4c9eafab6d0

Don’t log every instruction executed, nobody is interested in that, and demote unhandled opcodes to debug.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 26 Jul 2014 14:46:03 +0200
parents 94229756abd9
children f3778145d7e7
files pytouhou/vm/anmrunner.py pytouhou/vm/eclrunner.py
diffstat 2 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/vm/anmrunner.py
+++ b/pytouhou/vm/anmrunner.py
@@ -88,10 +88,9 @@ class ANMRunner(object):
                 try:
                     callback = self.handlers[opcode]
                 except KeyError:
-                    logger.warn('unhandled opcode %d (args: %r)', opcode, args)
+                    logger.debug('[%d - %04d] unhandled opcode %d (args: %r)',
+                                 id(self), self.frame, opcode, args)
                 else:
-                    logger.debug('[%d - %04d] anm_%d%r', id(self),
-                                 self.frame, opcode, args)
                     callback(self, *args)
                     self._sprite.changed = True
 
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -59,7 +59,8 @@ class ECLMainRunner(object):
                 try:
                     callback = self.handlers[instr_type]
                 except KeyError:
-                    logger.warn('unhandled main opcode %d (args: %r)', instr_type, args)
+                    logger.debug('[%d - %04d] unhandled main opcode %d (args: %r)',
+                                 id(self), self.frame, instr_type, args)
                 else:
                     callback(self, sub, instr_type, *args)
 
@@ -173,13 +174,10 @@ class ECLRunner(object):
                 try:
                     callback = self.handlers[instr_type]
                 except KeyError:
-                    logger.warn('[%d %r - %04d] unhandled opcode %d (args: %r)',
-                                id(self), [self.sub] + [e[0] for e in self.stack],
-                                self.frame, instr_type, args)
+                    logger.debug('[%d %r - %04d] unhandled opcode %d (args: %r)',
+                                 id(self), [self.sub] + [e[0] for e in self.stack],
+                                 self.frame, instr_type, args)
                 else:
-                    logger.debug('[%d %r - %04d] ins_%d%r', id(self),
-                                 [self.sub] + [e[0] for e in self.stack],
-                                 self.frame, instr_type, args)
                     callback(self, *args)
 
         self.frame += 1