A version of Process.run() with BBOT logging and better error handling
(self)
| 33 | self.daemon = True |
| 34 | |
| 35 | def run(self): |
| 36 | """ |
| 37 | A version of Process.run() with BBOT logging and better error handling |
| 38 | """ |
| 39 | log = logging.getLogger("bbot.core.process") |
| 40 | try: |
| 41 | if self.log_level is not None and self.log_queue is not None: |
| 42 | from bbot.core import CORE |
| 43 | |
| 44 | CORE.logger.setup_queue_handler(self.log_queue, self.log_level) |
| 45 | if self.custom_name: |
| 46 | from setproctitle import setproctitle |
| 47 | |
| 48 | setproctitle(str(self.custom_name)) |
| 49 | super().run() |
| 50 | except BaseException as e: |
| 51 | if not in_exception_chain(e, (KeyboardInterrupt,)): |
| 52 | log.warning(f"Error in {self.name}: {e}") |
| 53 | log.trace(traceback.format_exc()) |
nothing calls this directly
no test coverage detected