Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 376 Lines • ▼ Show 20 Lines | def _start_logging(self): | ||||
ch = logging.StreamHandler(sys.stdout) | ch = logging.StreamHandler(sys.stdout) | ||||
# User can provide log level as a number or string (eg DEBUG). loglevel | # User can provide log level as a number or string (eg DEBUG). loglevel | ||||
# was caught as a string, so try to convert it to an int | # was caught as a string, so try to convert it to an int | ||||
ll = int(self.options.loglevel) if self.options.loglevel.isdigit( | ll = int(self.options.loglevel) if self.options.loglevel.isdigit( | ||||
) else self.options.loglevel.upper() | ) else self.options.loglevel.upper() | ||||
ch.setLevel(ll) | ch.setLevel(ll) | ||||
# Format logs the same as bitcoind's debug.log with microprecision (so log files can be concatenated and sorted) | # Format logs the same as bitcoind's debug.log with microprecision (so log files can be concatenated and sorted) | ||||
formatter = logging.Formatter( | formatter = logging.Formatter( | ||||
fmt='%(asctime)s.%(msecs)03d000 %(name)s (%(levelname)s): %(message)s', datefmt='%Y-%m-%d %H:%M:%S') | fmt='%(asctime)s.%(msecs)03d000Z %(name)s (%(levelname)s): %(message)s', datefmt='%Y-%m-%dT%H:%M:%S') | ||||
formatter.converter = time.gmtime | formatter.converter = time.gmtime | ||||
fh.setFormatter(formatter) | fh.setFormatter(formatter) | ||||
ch.setFormatter(formatter) | ch.setFormatter(formatter) | ||||
# add the handlers to the logger | # add the handlers to the logger | ||||
self.log.addHandler(fh) | self.log.addHandler(fh) | ||||
self.log.addHandler(ch) | self.log.addHandler(ch) | ||||
if self.options.trace_rpc: | if self.options.trace_rpc: | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |