MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / format

Method format

tensorpack/utils/logger.py:30–45  ·  view source on GitHub ↗
(self, record)

Source from the content-addressed store, hash-verified

28
29class _MyFormatter(logging.Formatter):
30 def format(self, record):
31 date = colored('[%(asctime)s @%(filename)s:%(lineno)d]', 'green')
32 msg = '%(message)s'
33 if record.levelno == logging.WARNING:
34 fmt = date + ' ' + colored('WRN', 'red', attrs=['blink']) + ' ' + msg
35 elif record.levelno == logging.ERROR or record.levelno == logging.CRITICAL:
36 fmt = date + ' ' + colored('ERR', 'red', attrs=['blink', 'underline']) + ' ' + msg
37 elif record.levelno == logging.DEBUG:
38 fmt = date + ' ' + colored('DBG', 'yellow', attrs=['blink']) + ' ' + msg
39 else:
40 fmt = date + ' ' + msg
41 if hasattr(self, '_style'):
42 # Python3 compatibility
43 self._style._fmt = fmt
44 self._fmt = fmt
45 return super(_MyFormatter, self).format(record)
46
47
48def _getlogger():

Callers 15

add_git_versionFunction · 0.80
_check_nameFunction · 0.80
post_process_modelMethod · 0.80
_setup_graphMethod · 0.80
get_costFunction · 0.80
__repr__Method · 0.80
processMethod · 0.80
proc_fcMethod · 0.80
proc_scaleMethod · 0.80
get_caffe_pbFunction · 0.80
loadcaffe.pyFile · 0.80
downloadFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_shape_matchMethod · 0.64