Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2500)

Unified Diff: build/android/pylib/utils/run_tests_helper.py

Issue 13601030: [android] Improve logging output. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: modify format Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/cmd_helper.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/utils/run_tests_helper.py
diff --git a/build/android/pylib/utils/run_tests_helper.py b/build/android/pylib/utils/run_tests_helper.py
index 15e5d5381bcc9b6d9a3e97dcbed40191556a9904..e106392056c892f27563dcb7e91e3477c3334de2 100644
--- a/build/android/pylib/utils/run_tests_helper.py
+++ b/build/android/pylib/utils/run_tests_helper.py
@@ -6,6 +6,18 @@
import logging
import os
+import time
+
+
+class CustomFormatter(logging.Formatter):
+ def __init__(self, fmt=''):
frankf 2013/04/06 00:20:53 comments.
+ super(CustomFormatter, self).__init__(fmt=fmt)
+ self._creation_time = time.time()
+
+ def format(self, record):
+ msg = super(CustomFormatter, self).format(record)
+ timediff = str(int(time.time() - self._creation_time))
+ return '%s %ss %s' % (record.levelname[0], timediff.rjust(4), msg)
def GetExpectations(file_name):
@@ -23,4 +35,8 @@ def SetLogLevel(verbose_count):
log_level = logging.INFO
elif verbose_count >= 2:
log_level = logging.DEBUG
- logging.getLogger().setLevel(log_level)
+ logger = logging.getLogger()
+ logger.setLevel(log_level)
+ ch = logging.StreamHandler()
+ ch.setFormatter(CustomFormatter())
frankf 2013/04/06 00:20:53 ch -> custom_handler
+ logging.getLogger().addHandler(ch)
« no previous file with comments | « build/android/pylib/cmd_helper.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698