diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-02-07 02:31:15 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-02-07 02:31:15 +0100 |
commit | e5e0533b6e355482f68592de1bff7e4af8f482ca (patch) | |
tree | c2f5061988fd6ec326184374ebc6652a4218825a /poezio/logger.py | |
parent | 42b87268b39557aa4cd0bac11f7d2bc760dbd38f (diff) | |
download | poezio-e5e0533b6e355482f68592de1bff7e4af8f482ca.tar.gz poezio-e5e0533b6e355482f68592de1bff7e4af8f482ca.tar.bz2 poezio-e5e0533b6e355482f68592de1bff7e4af8f482ca.tar.xz poezio-e5e0533b6e355482f68592de1bff7e4af8f482ca.zip |
logger: Log the JID during a parsing error.
Diffstat (limited to 'poezio/logger.py')
-rw-r--r-- | poezio/logger.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/poezio/logger.py b/poezio/logger.py index c8ec66d9..d43cc759 100644 --- a/poezio/logger.py +++ b/poezio/logger.py @@ -56,14 +56,14 @@ class LogMessage(LogItem): self.nick = nick -def parse_log_line(msg: str) -> Optional[LogItem]: +def parse_log_line(msg: str, jid: str) -> Optional[LogItem]: 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) + log.debug('Error while parsing %s’s logs: “%s”', jid, msg) return None @@ -176,7 +176,7 @@ class Logger: filename, exc_info=True) return None - return parse_log_lines(lines) + return parse_log_lines(lines, jid) def log_message(self, jid: str, @@ -306,7 +306,7 @@ def _get_lines_from_fd(fd: IO[Any], nb: int = 10) -> List[str]: return lines -def parse_log_lines(lines: List[str]) -> List[Dict[str, Any]]: +def parse_log_lines(lines: List[str], jid: str) -> List[Dict[str, Any]]: """ Parse raw log lines into poezio log objects """ @@ -320,7 +320,7 @@ def parse_log_lines(lines: List[str]) -> List[Dict[str, Any]]: idx += 1 log.debug('fail?') continue - log_item = parse_log_line(lines[idx]) + log_item = parse_log_line(lines[idx], jid) idx += 1 if not isinstance(log_item, LogItem): log.debug('wrong log format? %s', log_item) |