MCPcopy
hub / github.com/microsoft/Cream / format

Method format

CDARTS/CDARTS_segmentation/tools/engine/logger.py:15–39  ·  view source on GitHub ↗
(self, record)

Source from the content-addressed store, hash-verified

13 msg = '%(message)s'
14
15 def format(self, record):
16 if record.levelno == logging.DEBUG:
17 mcl, mtxt = self._color_dbg, 'DBG'
18 elif record.levelno == logging.WARNING:
19 mcl, mtxt = self._color_warn, 'WRN'
20 elif record.levelno == logging.ERROR:
21 mcl, mtxt = self._color_err, 'ERR'
22 else:
23 mcl, mtxt = self._color_normal, ''
24
25 if mtxt:
26 mtxt += ' '
27
28 if self.log_fout:
29 self.__set_fmt(self.date_full + mtxt + self.msg)
30 formatted = super(LogFormatter, self).format(record)
31 # self.log_fout.write(formatted)
32 # self.log_fout.write('\n')
33 # self.log_fout.flush()
34 return formatted
35
36 self.__set_fmt(self._color_date(self.date) + mcl(mtxt + self.msg))
37 formatted = super(LogFormatter, self).format(record)
38
39 return formatted
40
41 if sys.version_info.major < 3:
42 def __set_fmt(self, fmt):

Callers 15

__str__Method · 0.80
__getattr__Method · 0.80
__str__Method · 0.80
log_everyMethod · 0.80
init_distributed_modeFunction · 0.80
irpe.pyFile · 0.80
__repr__Method · 0.80
__repr__Method · 0.80
train_one_epochFunction · 0.80
evaluateFunction · 0.80
mainFunction · 0.80
train_one_epochFunction · 0.80

Calls 2

__set_fmtMethod · 0.95
_color_dateMethod · 0.95

Tested by 12

mainFunction · 0.64
validateFunction · 0.64
test_sampleFunction · 0.64
test_sampleFunction · 0.64
mainFunction · 0.64
collect_resultsFunction · 0.64
mainFunction · 0.64
collect_results_cpuFunction · 0.64
mainFunction · 0.64
__repr__Method · 0.64
mainFunction · 0.64
mainFunction · 0.64