Passed
Push — develop ( e15ceb...5f9839 )
by Dean
02:51
created

ErrorStorage.emit()   A

Complexity

Conditions 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
crap 12
1
from plugin.managers.exception import ExceptionManager
2
import logging
3
4
log = logging.getLogger(__name__)
5
6
7
class ErrorStorage(logging.Handler):
8
    def __init__(self):
9
        super(ErrorStorage, self).__init__()
10
11
    def emit(self, record):
12
        if record.levelno < logging.ERROR:
13
            return
14
15
        if record.exc_info:
16
            ExceptionManager.create.from_exc_info(record.exc_info)
17
            return
18
19
        self.format(record)
20
21
        ExceptionManager.create.from_message(record.message)
0 ignored issues
show
Bug introduced by
It seems like a value for argument message is missing in the unbound method call.
Loading history...
22
23
ERROR_STORAGE_HANDLER = ErrorStorage()
24