| Total Complexity | 6 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from plugin.managers.exception import ExceptionManager |
||
| 9 | class ErrorStorage(logging.Handler): |
||
| 10 | def __init__(self): |
||
| 11 | super(ErrorStorage, self).__init__() |
||
| 12 | |||
| 13 | def emit(self, record): |
||
| 14 | if record.levelno < logging.ERROR: |
||
| 15 | return |
||
| 16 | |||
| 17 | try: |
||
| 18 | if record.exc_info: |
||
| 19 | ExceptionManager.create.from_exc_info(record.exc_info) |
||
| 20 | return |
||
| 21 | |||
| 22 | self.format(record) |
||
| 23 | |||
| 24 | ExceptionManager.create.from_message(record.message) |
||
|
|
|||
| 25 | except DisabledError: |
||
| 26 | pass |
||
| 27 | except Exception as ex: |
||
| 28 | log.warn('Unable to store exception message: %s', ex, exc_info=True) |
||
| 29 | |||
| 31 |