QtHandler.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
1
import logging
2
3
4
class QtHandler(logging.Handler):
5
6
    def __init__(self, widget):
7
        logging.Handler.__init__(self)
8
        self.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
9
        self.setFormatter(logging.Formatter("%(name)s - %(levelname)s - %(message)s')"))
10
        self.widget = widget
11
12
    def emit(self, record):
13
        msg = self.format(record)
14
        print(msg)  # print to stdout also!
15
        self.widget.append(msg)
16
17
18
19
20