MCPcopy Create free account
hub / github.com/VCIP-RGBD/DFormer / format

Method format

utils/engine/logger.py:24–48  ·  view source on GitHub ↗
(self, record)

Source from the content-addressed store, hash-verified

22 msg = "%(message)s"
23
24 def format(self, record):
25 if record.levelno == logging.DEBUG:
26 mcl, mtxt = self._color_dbg, "DBG"
27 elif record.levelno == logging.WARNING:
28 mcl, mtxt = self._color_warn, "WRN"
29 elif record.levelno == logging.ERROR:
30 mcl, mtxt = self._color_err, "ERR"
31 else:
32 mcl, mtxt = self._color_normal, ""
33
34 if mtxt:
35 mtxt += " "
36
37 if self.log_fout:
38 self.__set_fmt(self.date_full + mtxt + self.msg)
39 formatted = super(LogFormatter, self).format(record)
40 # self.log_fout.write(formatted)
41 # self.log_fout.write('\n')
42 # self.log_fout.flush()
43 return formatted
44
45 self.__set_fmt(self._color_date(self.date) + mcl(mtxt + self.msg))
46 formatted = super(LogFormatter, self).format(record)
47
48 return formatted
49
50 if sys.version_info.major < 3:
51

Callers 8

_color_dbgMethod · 0.45
_color_warnMethod · 0.45
_color_errMethod · 0.45
_color_omittedMethod · 0.45
_color_dateMethod · 0.45
__init__Method · 0.45
save_checkpointMethod · 0.45
restore_checkpointMethod · 0.45

Calls 2

__set_fmtMethod · 0.95
_color_dateMethod · 0.95

Tested by

no test coverage detected