diff options
author | MatthewLi <matthew.lijun@huawei.com> | 2017-01-11 07:55:14 -0500 |
---|---|---|
committer | MatthewLi <matthew.lijun@huawei.com> | 2017-01-11 08:08:48 -0500 |
commit | 3114be6f8c77962e27551645af1859c51a110600 (patch) | |
tree | 65d7affa8a8e627b369d8633ec63498f26660fdb /dovetail/report.py | |
parent | 0c57358d86d0a1d155b66e3af015be5be7e80e79 (diff) |
dovetail tool: switch logging to proper usage
JIRA: DOVETAIL-178
Change-Id: Ica814d4ff634c9159e4ecca888b8cc0f6c16e624
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'dovetail/report.py')
-rw-r--r-- | dovetail/report.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/dovetail/report.py b/dovetail/report.py index 5da6ef87..91a4ebd4 100644 --- a/dovetail/report.py +++ b/dovetail/report.py @@ -160,9 +160,9 @@ class Report: with open(os.path.join(dt_cfg.dovetail_config['result_dir'], report_file_name), 'w') as report_file: report_file.write(report) - cls.logger.info('save report to %s' % report_file_name) + cls.logger.info('save report to %s', report_file_name) except Exception: - cls.logger.error('Failed to save: %s' % report_file_name) + cls.logger.error('Failed to save: %s', report_file_name) @classmethod def get_result(cls, testcase): @@ -181,12 +181,12 @@ class Report: if result is not None: cls.results[type][validate_testcase] = result testcase.script_result_acquired(True) - cls.logger.debug('testcase: %s -> result acquired' % + cls.logger.debug('testcase: %s -> result acquired', validate_testcase) else: retry = testcase.increase_retry() - cls.logger.debug('testcase: %s -> result acquired retry:%d' % - (validate_testcase, retry)) + cls.logger.debug('testcase: %s -> result acquired retry:%d', + validate_testcase, retry) return result @@ -218,7 +218,7 @@ class FunctestCrawler: os.path.join(dovetail_config['result_dir'], dovetail_config[self.type]['result']['file_path']) if not os.path.exists(file_path): - self.logger.info('result file not found: %s' % file_path) + self.logger.info('result file not found: %s', file_path) return None try: @@ -240,24 +240,24 @@ class FunctestCrawler: "duration": int(dur_sec_int), "tests": int(num_tests), "failures": failed_num, "errors": error_logs}} - self.logger.debug('Results: %s' % str(json_results)) + self.logger.debug('Results: %s', str(json_results)) return json_results except Exception as e: self.logger.error('Cannot read content from the file: %s, ' - 'exception: %s' % (file_path, e)) + 'exception: %s', file_path, e) return None def crawl_from_url(self, testcase=None): url = \ dt_cfg.dovetail_config[self.type]['result']['db_url'] % \ testcase.validate_testcase() - self.logger.debug("Query to rest api: %s" % url) + self.logger.debug("Query to rest api: %s", url) try: data = json.load(urllib2.urlopen(url)) return data['results'][0] except Exception as e: self.logger.error("Cannot read content from the url: %s, " - "exception: %s" % (url, e)) + "exception: %s", url, e) return None @@ -287,18 +287,18 @@ class YardstickCrawler: file_path = os.path.join(dt_cfg.dovetail_config['result_dir'], testcase.validate_testcase() + '.out') if not os.path.exists(file_path): - self.logger.info('result file not found: %s' % file_path) + self.logger.info('result file not found: %s', file_path) return None try: with open(file_path, 'r') as myfile: myfile.read() criteria = 'PASS' json_results = {'criteria': criteria} - self.logger.debug('Results: %s' % str(json_results)) + self.logger.debug('Results: %s', str(json_results)) return json_results except Exception as e: self.logger.error('Cannot read content from the file: %s, ' - 'exception: %s' % (file_path, e)) + 'exception: %s', file_path, e) return None def crawl_from_url(self, testcase=None): @@ -377,7 +377,7 @@ class FunctestChecker: all_passed = True for sub_testcase in sub_testcase_list: - self.logger.debug('check sub_testcase:%s' % sub_testcase) + self.logger.debug('check sub_testcase:%s', sub_testcase) if sub_testcase in db_result['details']['errors']: testcase.sub_testcase_passed(sub_testcase, False) all_passed = False |