Use match groups instead of re.split because we don't want that
This commit is contained in:
parent
c88459c507
commit
9f7041f65e
1 changed files with 7 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue