MCPcopy Create free account
hub / github.com/alibaba/BladeDISC / ColoredLogger

Class ColoredLogger

scripts/python/common_setup.py:122–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 return logging.Formatter.format(self, record)
121
122 class ColoredLogger(logging.Logger):
123 FORMAT = "{}%(asctime)s{} %(levelname)19s %(message)s".format(
124 BOLD_SEQ, RESET_SEQ
125 )
126
127 def __init__(self, name):
128 logging.Logger.__init__(self, name, logging.DEBUG)
129 color_formatter = ColoredFormatter(
130 self.FORMAT, use_color=sys.stdout.isatty() and sys.stderr.isatty()
131 )
132 console = logging.StreamHandler()
133 console.setFormatter(color_formatter)
134 self.addHandler(console)
135 return
136
137 logging.setLoggerClass(ColoredLogger)
138 logger = logging.getLogger("tao_ci")

Callers

nothing calls this directly

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected