MCPcopy
hub / github.com/InternLM/lmdeploy / format

Method format

lmdeploy/utils.py:72–81  ·  view source on GitHub ↗

format.

(self, record: LogRecord)

Source from the content-addressed store, hash-verified

70 _RESET_COLOR = '\033[0m'
71
72 def format(self, record: LogRecord):
73 """format."""
74 if not can_colorize():
75 # windows does not support ASNI color
76 return super().format(record)
77 levelname = record.levelname
78 level_color = self._LEVELNAME_COLOR_MAP.get(levelname, self._RESET_COLOR)
79 levelname = f'{level_color}{levelname}{self._RESET_COLOR}'
80 record.levelname = levelname
81 return super().format(record)
82
83
84class FilterDuplicateWarning(logging.Filter):

Callers 7

fmtMethod · 0.80
tab_rowMethod · 0.80
summarizeMethod · 0.80
_set_funcFunction · 0.80
update_moe_mappingFunction · 0.80
extra_reprMethod · 0.80
benchmarkFunction · 0.80

Calls 2

can_colorizeFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected