QtHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
dl 0
loc 12
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 5 1
A emit() 0 4 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