helpers.LogFormatter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 13
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A LogFormatter.format() 0 4 1
1
import logging
2
import time
3
# ------------------------------------------------------------
4
5
6
class LogFormatter(logging.Formatter):
7
    formats = {
8
        logging.ERROR: "%(asctime)s - %(levelname)s - %(message)s",
9
        logging.DEBUG: (
10
            "%(asctime)s - %(levelname)s - %(message)s in "
11
            "%(funcName)s line %(lineno)d"
12
        ),
13
        logging.INFO: "%(asctime)s - %(levelname)s - %(message)s"
14
    }
15
16
    def format(self, record: logging.LogRecord):
17
        f = logging.Formatter(self.formats.get(record.levelno))
18
        f.converter = time.gmtime
19
        return f.format(record)
20