MCPcopy Index your code
hub / github.com/dobin/SuperMega / CustomFormatter

Class CustomFormatter

log.py:18–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17
18class CustomFormatter(logging.Formatter):
19 #format = "%(asctime)s - %(name)-12s - [%(levelname)-8s] - %(message)s (%(filename)s:%(lineno)d)"
20 format = "(%(filename)-16s) %(message)s"
21
22 FORMATS = {
23 logging.DEBUG: format,
24 logging.INFO: format,
25 logging.WARNING: LogColors.WARNING + format + LogColors.ENDC,
26 logging.ERROR: LogColors.FAIL + format + LogColors.ENDC,
27 logging.CRITICAL: LogColors.FAIL + LogColors.BOLD + format + LogColors.ENDC
28 }
29
30 def format(self, record):
31 log_fmt = self.FORMATS.get(record.levelno)
32 formatter = logging.Formatter(log_fmt, datefmt="%Y-%m-%d %H:%M:%S")
33 return formatter.format(record)
34
35
36class ListHandler(logging.Handler):

Callers 1

setup_loggingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected