comparison pytouhou/game/eclrunner.py @ 58:3da4de9decd0

Use logging module
author Thibaut Girka <thib@sitedethib.com>
date Tue, 23 Aug 2011 21:01:50 +0200
parents 694f25881d0f
children 4fe37a620b22
comparison
equal deleted inserted replaced
57:694f25881d0f 58:3da4de9decd0
13 ## 13 ##
14 14
15 15
16 from math import atan2, cos, sin 16 from math import atan2, cos, sin
17 17
18 from pytouhou.utils.helpers import get_logger
19
20 logger = get_logger(__name__)
21
22
18 23
19 class MetaRegistry(type): 24 class MetaRegistry(type):
20 def __new__(mcs, name, bases, classdict): 25 def __new__(mcs, name, bases, classdict):
21 instruction_handlers = {} 26 instruction_handlers = {}
22 for item in classdict.itervalues(): 27 for item in classdict.itervalues():
94 99
95 if frame == self.frame: 100 if frame == self.frame:
96 try: 101 try:
97 callback = self._handlers[instr_type] 102 callback = self._handlers[instr_type]
98 except KeyError: 103 except KeyError:
99 print('Warning: unhandled opcode %d!' % instr_type) #TODO 104 logger.warn('unhandled opcode %d (args: %r)', instr_type, args)
100 else: 105 else:
101 callback(self, *args) 106 callback(self, *args)
102 107
103 self.frame += 1 108 self.frame += 1
104 return True 109 return True