| 204 | def wrap_handler(handler): # pragma: no cover |
| 205 | |
| 206 | class WithSafeHandleError(logging.Handler): |
| 207 | |
| 208 | def handleError(self, record): |
| 209 | try: |
| 210 | traceback.print_exc(None, sys.__stderr__) |
| 211 | except OSError: |
| 212 | pass # see python issue 5971 |
| 213 | |
| 214 | handler.handleError = WithSafeHandleError().handleError |
| 215 | return [wrap_handler(h) for h in self.logger.handlers] |