You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

17 lines
338 B

  1. #!/usr/bin/env python3
  2. from traceback import print_exception
  3. show_debug_messages = False
  4. def debug_print(what, force: bool = False):
  5. if not force and not show_debug_messages:
  6. return
  7. if isinstance(what, Exception):
  8. print_exception(type(what), value=what, tb=None)
  9. else:
  10. print("[DEBUG] %s" % what)