| Total Complexity | 1 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |