From a071ccde4788d79f42022f0772a5e07c4303eb3c Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Wed, 7 Dec 2011 15:12:02 -0800 Subject: [PATCH] Bug 708427 - Print human-friendly times when dumping Sync logs; r=rnewman --- testing/tps/tps/testrunner.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/testing/tps/tps/testrunner.py b/testing/tps/tps/testrunner.py index 3f24085b9f5..b82b639ac79 100644 --- a/testing/tps/tps/testrunner.py +++ b/testing/tps/tps/testrunner.py @@ -236,11 +236,17 @@ class TPSTestRunner(object): for f in files: weavelog = os.path.join(profiles[profile].profile, 'weave', 'logs', f) if os.access(weavelog, os.F_OK): - f = open(weavelog, 'r') - msg = f.read() - self.log(msg) - f.close() - self.log("\n") + with open(weavelog, 'r') as fh: + for line in fh: + possible_time = line[0:13] + if len(possible_time) == 13 and possible_time.isdigit(): + time_ms = int(possible_time) + formatted = time.strftime('%Y-%m-%d %H:%M:%S', + time.localtime(time_ms / 1000)) + self.log('%s.%03d %s' % ( + formatted, time_ms % 1000, line[14:] )) + else: + self.log(line) break; # grep the log for FF and sync versions