def apiFilterFile(filePath, api): try: logFile = open(filePath, 'r') filterFile = open(filePath + '.ft', 'w') for logEntry in logFile: parser = LogEntryParser(logEntry) if parser.getPath() == api: filterFile.write(logEntry) except Exception, e: print "Exception in apiFilter: %s" % e
def apiFilterFile(filePath, api): try: logFile = open(filePath, 'r') filterFile = open(filePath+'.ft', 'w') for logEntry in logFile: parser = LogEntryParser(logEntry) if parser.getPath() == api: filterFile.write(logEntry) except Exception, e: print "Exception in apiFilter: %s" % e
def apiFilter(filePath, api): try: logFile = open(filePath, 'r') filterList = [] for logEntry in logFile: parser = LogEntryParser(logEntry) if parser.getPath() == api: filterList.append(logEntry) return filterList except Exception, e: print "Exception in apiFilter: %s" % e
def parseLogList(logList): if logList is None: raise Exception("Log list is none") analyzeResult = {} time = "" count = 0 for logEntry in logList: parser = LogEntryParser(logEntry) t = parser.getTimeMin() if time != t: count = 1 analyzeResult[t] = count time = t else: count += 1 analyzeResult[t] = count return analyzeResult
def parseLogFile(filePath): try: logFile = open(filePath, 'r') analyzeResult = {} time = "" count = 0 for logEntry in logFile: parser = LogEntryParser(logEntry) t = parser.getTimeMin() if time != t: count = 1 analyzeResult[t] = count time = t else: count += 1 analyzeResult[t] = count return analyzeResult except Exception, e: print "Exception in parseLogFile: %s" % e