AI 143562: Usability fixes for runtest.py

BUG=1743678

Automated import of CL 143562
This commit is contained in:
Brett Chabot
2009-03-30 17:00:24 -07:00
committed by The Android Open Source Project
parent 9738144670
commit f7dd570dec
4 changed files with 66 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ import datetime
_LOG_FILE = None
_verbose = False
_log_time = True
def Init(log_file_path):
"""Set the path to the log file"""
@@ -57,8 +58,13 @@ def _WriteLog(msg):
def _PrependTimeStamp(log_string):
"""Returns the log_string prepended with current timestamp """
return "# %s: %s" % (datetime.datetime.now().strftime("%m/%d/%y %H:%M:%S"),
log_string)
global _log_time
if _log_time:
return "# %s: %s" % (datetime.datetime.now().strftime("%m/%d/%y %H:%M:%S"),
log_string)
else:
# timestamp logging disabled
return log_string
def SilentLog(new_str):
"""Silently log new_str. Unless verbose mode is enabled, will log new_str
@@ -77,7 +83,12 @@ def SetVerbose(new_verbose=True):
""" Enable or disable verbose logging"""
global _verbose
_verbose = new_verbose
def SetTimestampLogging(new_timestamp=True):
""" Enable or disable outputting a timestamp with each log entry"""
global _log_time
_log_time = new_timestamp
def main():
pass