summaryrefslogtreecommitdiff
path: root/poezio/logger.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-06-26 14:53:17 +0200
committermathieui <mathieui@mathieui.net>2021-06-26 14:53:17 +0200
commite5b4f7ab0d2159d938fe0aa42ab7aba7cd7e6fc5 (patch)
tree3c73a515168703a8c36879dc7f559e5a84374c66 /poezio/logger.py
parent1456566f1037eb07fd004b6d8916aa6e20af1647 (diff)
downloadpoezio-e5b4f7ab0d2159d938fe0aa42ab7aba7cd7e6fc5.tar.gz
poezio-e5b4f7ab0d2159d938fe0aa42ab7aba7cd7e6fc5.tar.bz2
poezio-e5b4f7ab0d2159d938fe0aa42ab7aba7cd7e6fc5.tar.xz
poezio-e5b4f7ab0d2159d938fe0aa42ab7aba7cd7e6fc5.zip
fix: do not use re.match() on existing Pattern objects
this is duplicating effort and going through re._compile once more approximately slows down the log parsing by 15%
Diffstat (limited to 'poezio/logger.py')
-rw-r--r--poezio/logger.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/poezio/logger.py b/poezio/logger.py
index 429d5328..139b4046 100644
--- a/poezio/logger.py
+++ b/poezio/logger.py
@@ -82,10 +82,10 @@ def parse_log_line(msg: str, jid: str = '') -> Optional[LogItem]:
:param jid: jid (for error logging)
:returns: The LogItem or None on error
"""
- match = re.match(MESSAGE_LOG_RE, msg)
+ match = MESSAGE_LOG_RE.match(msg)
if match:
return LogMessage(*match.groups())
- match = re.match(INFO_LOG_RE, msg)
+ match = INFO_LOG_RE.match(msg)
if match:
return LogInfo(*match.groups())
log.debug('Error while parsing %s’s logs: “%s”', jid, msg)