def _resetLogging(self):
# ensure we dont attach the handlers multiple times.
if self.logging_initialized:
return
self.logging_initialized = True
with self.uid_manager:
util.mkdirIfAbsent(self.resultdir)
# attach logs to log files.
# This happens in addition to anything that
# is set up in the config file... ie. logs go everywhere
for (log, filename, fmt_str) in (
(self.state.state_log, "state.log", self.config['state_log_fmt_str']),
(self.build_log, "build.log", self.config['build_log_fmt_str']),
(self.root_log, "root.log", self.config['root_log_fmt_str'])):
fullPath = os.path.join(self.resultdir, filename)
fh = logging.FileHandler(fullPath, "a+")
formatter = logging.Formatter(fmt_str)
fh.setFormatter(formatter)
fh.setLevel(logging.NOTSET)
log.addHandler(fh)
log.info("Mock Version: %s", self.config['version'])
评论列表
文章目录