Merge pull request #218 from kwirk/multiline-rstrip

BF: Multiline regex now works with log line strip of "\r\n"
pull/219/merge
Yaroslav Halchenko 2013-05-09 08:36:17 -07:00
commit fcdb74a471
2 changed files with 7 additions and 6 deletions

View File

@ -117,7 +117,7 @@ class Regex:
n += 1
except IndexError:
break
return skippedLines.splitlines(True)
return skippedLines.splitlines(False)
##
# Returns unmatched lines.
@ -129,9 +129,9 @@ class Regex:
if not self.hasMatched():
return []
unmatchedLines = (
self._matchCache.string[:self._matchLineStart].splitlines(True)
self._matchCache.string[:self._matchLineStart].splitlines(False)
+ self.getSkippedLines()
+ self._matchCache.string[self._matchLineEnd:].splitlines(True))
+ self._matchCache.string[self._matchLineEnd:].splitlines(False))
return unmatchedLines
##
@ -145,7 +145,7 @@ class Regex:
if not self.hasMatched():
return []
matchedLines = self._matchCache.string[
self._matchLineStart:self._matchLineEnd].splitlines(True)
self._matchLineStart:self._matchLineEnd].splitlines(False)
return [line for line in matchedLines
if line not in self.getSkippedLines()]

View File

@ -325,7 +325,7 @@ class Filter(JailThread):
logLine = line
self.__lineBuffer = ((self.__lineBuffer +
[logLine])[-self.__lineBufferSize:])
return self.findFailure(timeLine, "".join(self.__lineBuffer))
return self.findFailure(timeLine, "\n".join(self.__lineBuffer) + "\n")
def processLineAndAdd(self, line):
"""Processes the line for failures and populates failManager
@ -373,7 +373,8 @@ class Filter(JailThread):
failRegex.search(logLine)
if failRegex.hasMatched():
# Checks if we must ignore this match.
if self.ignoreLine("".join(failRegex.getMatchedLines())):
if self.ignoreLine(
"\n".join(failRegex.getMatchedLines()) + "\n"):
# The ignoreregex matched. Remove ignored match.
self.__lineBuffer = failRegex.getUnmatchedLines()
continue