Commit 9f7041f6 authored by mathieui's avatar mathieui

Use match groups instead of re.split because we don't want that

parent c88459c5
......@@ -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):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment