MCPcopy Create free account
hub / github.com/ForgeRock/forgeops / NoColorFormatter

Class NoColorFormatter

lib/python/utils.py:92–106  ·  view source on GitHub ↗

Logging with no color

Source from the content-addressed store, hash-verified

90 sys.exit(code)
91
92class 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
108class ColorFormatter(logging.Formatter):
109 """Logging color"""

Callers 1

loggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected