25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

debug.py 337 B

123456789101112131415
  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)