(msg=None)
| 31 | |
| 32 | |
| 33 | def debug_exception(msg=None): |
| 34 | if DEBUG: |
| 35 | if msg: |
| 36 | debug(msg) |
| 37 | |
| 38 | with _debug_lock: |
| 39 | with open(DEBUG_FILE, "a+") as stream: |
| 40 | _pid_prefix = _pid_msg |
| 41 | if isinstance(msg, bytes): |
| 42 | _pid_prefix = _pid_prefix.encode("utf-8") |
| 43 | stream.write(_pid_prefix) |
| 44 | |
| 45 | traceback.print_exc(file=stream) |