-
-class debuggable_abstaining_renderer(abstaining_renderer):
- def __init__(self, name_to_timeout_dict, debug):
- super(debuggable_abstaining_renderer, self).__init__(name_to_timeout_dict)
- self.debug = debug
-
- def debug_prefix(self):
- return self.get_name()
-
- def being_debugged(self):
- return self.debug
-
- def debug_print(self, template, *args):
- try:
- if self.being_debugged():
- if args:
- msg = template.format(args)
- else:
- msg = template
-
- # current date and time
- now = datetime.now()
- timestamp = now.strftime("%d-%b-%Y (%H:%M:%S.%f)")
- print("%s(%s): %s" % (self.debug_prefix(), timestamp, msg))
- except Exception as e:
- print("Exception in debug_print!")
- print(e)