Closedown

This commit is contained in:
boccioli_m
2017-10-20 09:59:30 +02:00
parent a263e5df1d
commit f5dee9527c

View File

@@ -65,15 +65,17 @@ class TestingTool:
return self.testPath
def log(self, text):
def log(self, text, severity=0):
"""
Print/log information
text = the string to be printed/logged
severity = 0:Info 1:Warning 2:Error
"""
import time
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
logText = self.deviceName + ' - ' + self.testName + ': ' + str(text)
sev = ['INFO','WARN','ERRO']
logText = sev[severity] + ' - ' + self.deviceName + ' - ' + self.testName + ': ' + str(text)
print now + ' ' + logText
try:
log(logText)
@@ -116,7 +118,7 @@ class TestingTool:
if testPassed:
self.log('**** TEST PASSED ****')
else:
self.log('**** TEST FAILED ****')
self.log('**** TEST FAILED ****',2)
if returnString != '':
self.log(returnString)
ret = [self.testPath, self.deviceName, returnString, testPassed]