Logging with no color
| 90 | sys.exit(code) |
| 91 | |
| 92 | class NoColorFormatter(logging.Formatter): |
| 93 | """Logging with no color""" |
| 94 | NON_TTY_FORMATS = { |
| 95 | logging.DEBUG: f'{MSG_FMT}', |
| 96 | logging.INFO: f'{MSG_FMT}', |
| 97 | logging.WARNING: f'{MSG_FMT}', |
| 98 | logging.ERROR: f'{MSG_FMT}', |
| 99 | logging.CRITICAL: f'{MSG_FMT}', |
| 100 | } |
| 101 | |
| 102 | def format(self, record): |
| 103 | log_fmt = self.NON_TTY_FORMATS.get(record.levelno) |
| 104 | formatter = logging.Formatter(log_fmt) |
| 105 | formatter.datefmt = '%Y-%m-%dT%H:%M:%S%z' |
| 106 | return formatter.format(record) |
| 107 | |
| 108 | class ColorFormatter(logging.Formatter): |
| 109 | """Logging color""" |