diff options
author | mathieui <mathieui@mathieui.net> | 2017-09-28 00:32:10 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2017-09-28 00:32:10 +0200 |
commit | 9f7041f65e5cd345fa894bfbbb6e9235260d9c33 (patch) | |
tree | c32d1e30828fd6f1f00c8ce9cb182d64f4c4a8f8 | |
parent | c88459c507c66dc31df0533ad12b4343d05a4391 (diff) | |
download | poezio-9f7041f65e5cd345fa894bfbbb6e9235260d9c33.tar.gz poezio-9f7041f65e5cd345fa894bfbbb6e9235260d9c33.tar.bz2 poezio-9f7041f65e5cd345fa894bfbbb6e9235260d9c33.tar.xz poezio-9f7041f65e5cd345fa894bfbbb6e9235260d9c33.zip |
Use match groups instead of re.split because we don't want that
-rw-r--r-- | poezio/logger.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/poezio/logger.py b/poezio/logger.py index b5c81f82..1d98e059 100644 --- a/poezio/logger.py +++ b/poezio/logger.py @@ -52,10 +52,13 @@ class LogMessage(LogItem): self.nick = nick def parse_message_line(msg): - if re.match(MESSAGE_LOG_RE, msg): - return LogMessage(*[i for i in re.split(MESSAGE_LOG_RE, msg) if i]) - if re.match(INFO_LOG_RE, msg): - return LogInfo(*[i for i in re.split(INFO_LOG_RE, msg) if i]) + match = re.match(MESSAGE_LOG_RE, msg) + if match: + return LogMessage(*match.groups()) + match = re.match(INFO_LOG_RE, msg) + if match: + return LogInfo(*match.groups()) + log.debug('Error while parsing "%s"', msg) return None class Logger(object): |