當前位置: 首頁>>代碼示例>>Python>>正文


Python Log.Log類代碼示例

本文整理匯總了Python中log.Log.Log的典型用法代碼示例。如果您正苦於以下問題:Python Log類的具體用法?Python Log怎麽用?Python Log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Log類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: strToJson

def strToJson(data):
    try:
        datajson = json.loads(data)
    except BaseException, e:
        Log.debug("strToJson",  e)
        print e
        datajson = {}
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:7,代碼來源:jsonutil.py

示例2: con2mysql

 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]))
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:7,代碼來源:DbUtils.py

示例3: __init__

 def __init__(self, argv, multipleInstanceFlag = False):
     # output-file argv not exists,deafault name :Year-m-d-h-m-sreport.html
     self.expandColumnsTag = 'colspan=21'
     if len(argv) < 2:
         sys.stderr.write("usage: python input-file output-file\n")
         sys.exit(-1)
     if len(argv) == 2:
         self.outreportname = 'reports\\' + time.strftime('%Y-%m-%d-%H-%M-%S') + 'report.html'
         argv.append(self.outreportname)
     elif(len(argv) > 2):
         self.outreportname = argv[2]
         
     infilename = self.convertExcelToHtml(argv[1], multipleInstanceFlag)
     Log.info('html file: ' + infilename)      
     infile = open(infilename,'r')
     modtime = time.ctime(os.fstat(infile.fileno())[stat.ST_MTIME])
     try:
         self.outfile = open(argv[2],'w')
     except IOError:
         os.mkdir('reports\\')
         self.outfile = open(argv[2],'w')
     self.fixture.summary["input file"] = os.path.abspath(argv[1])
     self.fixture.summary["input update"] = modtime
     self.fixture.summary["output file"] = os.path.abspath(argv[2])
     self.input = infile.read()
     infile.close()
     self.output = self.outfile
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:27,代碼來源:ExcelRunner.py

示例4: doTables

 def doTables(self,tables, expandColumnsTag = None) :
     self.summary["run date"] = time.ctime(time.time())
     self.summary["run elapsed time"] = RunTime()
     while tables:
         try:
             heading = tables.at(0,0,0)
             if expandColumnsTag is not None:
                 tempTuple = expandColumnsTag.split('=')
                 heading.modifyTagValue(tempTuple[0], tempTuple[1])
         except BaseException, e:
             Log.exception(e)                 
         if heading:
             try:
                 path = heading.text()
                 #path = re.sub(r'^fit\.','',path) #try to cure the fits of madness
                 _CLASSNAME = path.split('.')[-1]
                 # fix for illegal Java trick in AllFiles. Frankly, I like it!
                 i = path.split('$')
                 if len(i) == 1:
                     exec 'import '+path
                     #test class method
                     exec 'fixture = '+path+'.'+_CLASSNAME+'()' 
                 else:
                     exec "import %s" % (i[0],)
                     exec "fixture = %s.%s()" % (i[0], i[1])
                 fixture.counts = self.counts
                 fixture.summary = self.summary
                 fixture.doTable(tables, expandColumnsTag)
             except Exception, e:
                 self.exception(heading, e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:30,代碼來源:Fixture.py

示例5: proceHeadInfo

 def proceHeadInfo(self, info):
     try:
         if info and 'Set-Cookie' in info:
             self.headerinfo = info
             self.cookie = info['Set-Cookie']
     except:
         Log.debug('proceHeadInfo error') 
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:7,代碼來源:__init__.py

示例6: getCookie

 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)  
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:7,代碼來源:__init__.py

示例7: bind

 def bind (self, heads, expandColumnsTag = None):
     self.columnBindings = [None] * heads.size()
     i = 0
     while heads:
         name = heads.text()
         # strip ' ','\n'
         name = name.replace(' ', '')
         name = name.replace('\n','')
         sufix = "()"
         try:
             if name[-len(sufix):] == sufix:
                 self.columnBindings[i] = \
                     self.bindMethod(name[:-len(sufix)])
                 if expandColumnsTag is not None: 
                     setattr(self, 'rowspan', 2) # added  in  2009/08/21, the first row means show test result, second test data      
                     style = heads.getStyle()
                     if style is None:
                         style = ''
                     try:
                         heads.addToBody(self.getExpandheads(style))
                     except AttributeError, e:
                         Log.info('please implement getExpandheads()!')
                         Log.exception(e)
             else: # name is field 
                 self.columnBindings[i] = self.bindField(name)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:25,代碼來源:ColumnFixture.py

示例8: runTest

 def runTest(self):
     Log.debug('start: ExcelTestDriver.runTest')
     fixture = None
     starttime = datetime.datetime.now()
     runTime = 0
     iterationCount = GlobalSetting.ITERATION
     if type(iterationCount) != types.IntType:
         iterationCount = 0
     count = 0
     while True:
         count += 1
         fixture = ExcelColumnFixture()
         excelAPP = util.excel.ExcelAppRD()
         excelAPP.openExcel(self.infilename)
         print 'now start to test......'
         reportFileName = 'report'
         if count > 1:
             reportFileName = 'report' + str(count)
         fixture.dosheets(excelAPP, reportFileName)
         endtime = datetime.datetime.now()
         runTime = (endtime - starttime).seconds
         print 'run time(seconds) is: ' + str(runTime)
         #Log.debug('open report ' + str(fixture.reportNameList))
         fixture.openFileReport()
         if GlobalSetting.RUNTIME > 0:
             if runTime > GlobalSetting.RUNTIME:
                 break
         elif iterationCount < 1:
             break
         iterationCount -= 1
     Log.debug('end: ExcelTestDriver.runTest')
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:31,代碼來源:ExcelTestDriver.py

示例9: strToDict

def strToDict(data):
    result = {}
    try:
        if data:
            result = eval(data)
    except BaseException, e:
        Log.error("strToDict exception, ", e)
        Log.error("data is, ", data)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:8,代碼來源:__init__.py

示例10: query

 def query(self, sql):
     results = None
     try:
         if self.cur.execute(sql):
             results = self.cur.fetchall()
     except:
         Log.error("query fail!")
     return results
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:8,代碼來源:DbUtils.py

示例11: openReport

 def openReport(self):
     Log.debug(self.reportNameList)
     for reportName in self.reportNameList:
         try:
             print reportName
             webbrowser.open_new(reportName)
         except BaseException, e:
             Log.exception(e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:8,代碼來源:ExcelColumnFixture.py

示例12: getneedSavePreResultkeyRe

 def getneedSavePreResultkeyRe(self, value, key):
     restr = ''
     try:
         restr = '\\"' + key + '\\"' + ':' + '\\"' + value + '\\"'
     except:
         pass
     Log.debug('match re: ', restr)
     return restr
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:8,代碼來源:CommonFixture.py

示例13: close

 def close(self):
     try:
         self.cur.close()
         self.conn.close()
         print "close db success!"
     except:
         Log.error("close fail!")
         print 'close db fail!'
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:8,代碼來源:DbUtils.py

示例14: setUrl

 def setUrl(self):
     #如果測試用例沒有url列,或者為空,則用表頭的url值
     if not hasattr(self, 'url') or not self.url:
         if self.interface and self.function:
             self.url = self.interface + self.function
         else:
             Log.debug("self.interface or  self.function is none")
             Log.debug("self.url", self.url)
     return self.url
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:9,代碼來源:HttpApiFixture.py

示例15: makeReportTail

 def makeReportTail(self, counts, outputReport=None):
     if outputReport == None:
         outputReport = self.outputReport
     try:
         testResult = 'Test Result: ' + counts.toString()
         outputReport.write('<H2>' + testResult + '</H2>\n')
     except BaseException, e:
         Log.debug('counts')
         Log.debug(e)
開發者ID:zhukovaskychina,項目名稱:httpautomation,代碼行數:9,代碼來源:Report.py


注:本文中的log.Log.Log類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。