AI 143713: am: CL 143688 am: CL 143562 Usability fixes for runtest.py

Original author: brettchabot
  Merged from: //branches/cupcake/...
  Original author: android-build
  Merged from: //branches/donutburger/...

Automated import of CL 143713
This commit is contained in:
Brett Chabot
2009-03-31 14:21:33 -07:00
committed by The Android Open Source Project
parent 363efea89c
commit 9bec3079c9
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