Exemplo n.º 1
0
		def run(self):
			res = []
			with open(self._log_file, "r") as fd:
				while True:
					line = fd.readline()
					if line == "":
						break
					if self._pattern.match(line):
						self.logger.debug("find one")
						m = Const.LOG_DATE_PATTERN.match(line)
						if m:
							year, month, day, hour, minute, sec, mill_sec = \
								int(m.group(1)), int(m.group(2)), int(m.group(3)), \
								int(m.group(4)), int(m.group(5)), int(m.group(6)), int(m.group(7))

							t = Utility.convert_time_int(datetime.datetime(year, month, day, hour, minute, sec)) \
								+ mill_sec
						else:
							self.logger.error("can not find date")
							t = 0
						res.append((t, line, ))

			self.logger.debug("after scan file")
			while self._lock.acquire():
				try:
					self._finder.add_result(res)
				finally:
					self._lock.release()
				break