| 12 | |
| 13 | # Custom Log Handler, ensuring flush |
| 14 | class FlushingStreamHandler(logging.StreamHandler): |
| 15 | def emit(self, record): |
| 16 | try: |
| 17 | super().emit(record) |
| 18 | self.flush() |
| 19 | except Exception: |
| 20 | self.handleError(record) |
| 21 | |
| 22 | |
| 23 | # Configure logging |