本文整理匯總了Python中log.Log.Log.error方法的典型用法代碼示例。如果您正苦於以下問題:Python Log.error方法的具體用法?Python Log.error怎麽用?Python Log.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類log.Log.Log
的用法示例。
在下文中一共展示了Log.error方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: savePreResultInfo
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def savePreResultInfo(self, resp):
Log.debug('start savePreResultInfo: ' + self._CLASSNAME)
try:
Log.debug('start savePreResultInfo: ' + resp)
respDict = strToDict(resp)
Log.debug('respDict: ', respDict)
Log.debug('needSavePreResults: ', self.needSavePreResults)
if respDict and self.needSavePreResults.find('{') > -1:
needSavePreResultDict = strToDict(self.needSavePreResults)
if needSavePreResultDict:
Log.debug('needSavePreResultDict: ', needSavePreResultDict)
for key in needSavePreResultDict:
self.getValueFromResp(key, needSavePreResultDict[key], respDict)
else:
print 'json或dictionary is error' + self.needSavePreResults#忽略
else:
needSavePreResultList = self.needSavePreResults.split(';')
for savePreResult in needSavePreResultList:
[key, value] = savePreResult.split('=')
# if respDict:
# self.getValueFromResp(key, value, respDict)
# else:
self.getValueFromResp(key, value, resp)
except BaseException, e:
Log.error(e)
示例2: dosheets
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def dosheets(self, excelAPP, reportFileName):
Log.debug('start: ExcelColumnFixture.dosheets')
self.excelAPP = excelAPP
self.reportFileName = reportFileName
self.summary["run date"] = time.ctime(time.time())
self.summary["run elapsed time"] = RunTime()
sheets = self.excelAPP.getShNameList()
self.reportNameList = []
try:
if not os.path.exists(REPORTPATH):
os.mkdir(REPORTPATH)
if not os.path.exists(FAILREPORTPATH):
os.mkdir(FAILREPORTPATH)
except:
Log.error("create report fail")
for sheetName in sheets:
self.counts = Counts()
if sheetName.lower().find("test") == -1:
continue
self.resetReportFileName(reportFileName, sheetName)
self.reportNameList.append(self.reportFileName)
#self.reportNameList.append(self.failReportFileName)
print 'start test: ', sheetName
try:
self.doSheet(excelAPP, sheetName)
except KeyboardInterrupt:
sys.exit(0)
self.makeSummaryReport()
Log.debug('end: ExcelColumnFixture.dosheets')
示例3: con2mysql
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def con2mysql(self):
try:
self.conn = MySQLdb.connect(self.host, self.user, self.passwd, self.database, self.port, charset='utf8')
self.cur = self.conn.cursor()
except MySQLdb.Error,e:
print "Mysql connect failed! Error %d: %s" % (e.args[0], e.args[1])
Log.error("Mysql Error %d: %s" % (e.args[0], e.args[1]))
示例4: getCookie
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def getCookie(self, respInfo):
cookie = ''
try:
if respInfo and 'Set-Cookie' in respInfo:
cookie = respInfo['Set-Cookie']
except BaseException, e:
Log.error("get cookie value error", e)
示例5: dorequest
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def dorequest(self, url, args=None, \
content_type=None, \
methodname='POST'):
response = None
Log.debug('url:', url)
Log.debug('args:', args)
self.setHeader()
if methodname.upper() == 'POST':
response = self.httppost(url, args, content_type)
elif methodname.upper() == 'GET':
response = self.get(url, args, content_type)
elif methodname.upper() == 'UPLOAD':
if os.path.exists(args):
response = self.uploadfile(url, args, content_type)
else:
Log.error('filepath is not exists: ', args)
response = 'filepath is not exists:'
else:
print 'does not implement!'
# try:
# cookie = self.getCookie(response.info())
# self.setCookie(cookie)
# except:
# pass
return response
示例6: strToDict
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def strToDict(data):
result = {}
try:
if data:
result = eval(data)
except BaseException, e:
Log.error("strToDict exception, ", e)
Log.error("data is, ", data)
示例7: close
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def close(self):
try:
self.cur.close()
self.conn.close()
print "close db success!"
except:
Log.error("close fail!")
print 'close db fail!'
示例8: query
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def query(self, sql):
results = None
try:
if self.cur.execute(sql):
results = self.cur.fetchall()
except:
Log.error("query fail!")
return results
示例9: getValueFromRespByPattern
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def getValueFromRespByPattern(self, pattern, resp):
result = ''
temp = re.findall(pattern, resp, re.IGNORECASE)
if temp:
#獲取匹配的第一個元組
try:
result = temp[0].split(":")[-1]#
except BaseException, e:
Log.error('getValueFromRespByPattern: ', e)
示例10: execute
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def execute(self, sql):
result = False
try:
result = self.cur.execute(sql)
Log.debug("execute sql statement!", sql)
print "execute sql success"
result = True
except Exception, e:
print "Execute Fail!"
Log.error("execute sql fail!", e)
示例11: getDynamicParamVlaue
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def getDynamicParamVlaue(self, paramvalue, fromWhDict):
pattern = '%\\w+%' #動態參數
result = paramvalue
try:
valueList = re.findall(pattern, paramvalue, re.IGNORECASE)
if len(valueList) > 0:
keyvalue = valueList[0][1:-1] #去掉%%
result = self.getValueFromRespByDict(keyvalue, fromWhDict)
print keyvalue, result
except BaseException, e:
Log.error('getDynamicParamVlaue error:', e)
示例12: getFixture
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def getFixture(self, fixturePath):
fixture = None
temp = fixturePath.split('.')
_CLASSNAME = temp[-1]
if len(temp) == 1:
fixturePath = 'fixture.' + _CLASSNAME
try:
exec 'import ' + fixturePath
exec 'fixture = ' + fixturePath + '.' + _CLASSNAME + '()'
except BaseException, e:
Log.error('getFixture error:', e)
示例13: runSetupFixture
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def runSetupFixture(self):
if self.setupFixture:
fixturePath = self.setupFixture[0]
fixtureParams = self.setupFixture[1]
_CLASSNAME = fixturePath.split('.')[-1]
try:
exec 'import ' + _CLASSNAME
exec 'fixture = ' + fixturePath + '.' + _CLASSNAME + '()'
self.initBeforeTest = fixture.run(fixtureParams)
except BaseException, e:
Log.error(e)
print e
示例14: getFixture
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def getFixture(self):
result = {}
if hasattr(self, 'fixturename'):
fixturepath = self.fixturename
fixturepath = fixturepath.strip()
fixturename = fixturepath.split('.')[-1]
try:
exec 'import ' + fixturepath
# test class method
exec 'execfixture = ' + fixturepath + '.' + fixturename + '()'
result = execfixture.run()
except BaseException, e:
Log.error(e)
示例15: saveRespDataToFile
# 需要導入模塊: from log.Log import Log [as 別名]
# 或者: from log.Log.Log import error [as 別名]
def saveRespDataToFile(self, respData):
fileName = str(self.testCaseId + 'json.txt')
path = LOGFIELPATH + self.curShName
if not os.path.exists(LOGFIELPATH):
os.mkdir(LOGFIELPATH)
try:
if not os.path.exists(path):
os.mkdir(path)
fileObject = open(path + os.sep + fileName, 'w')
fileObject.write(respData)
fileObject.close()
except BaseException, e:
Log.error("create jsontxt fail!", e)