summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-10-16 19:39:12 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-10-18 22:01:21 +0200
commita630f4a13ddecb2c7c8e9f9db08ef87646f6bb29 (patch)
tree660d0f54953c315952b53f84de183599c6989cb5
parentd626aa15339de2e573dd0ac7b20f54406210f76f (diff)
downloadpoezio-a630f4a13ddecb2c7c8e9f9db08ef87646f6bb29.tar.gz
poezio-a630f4a13ddecb2c7c8e9f9db08ef87646f6bb29.tar.bz2
poezio-a630f4a13ddecb2c7c8e9f9db08ef87646f6bb29.tar.xz
poezio-a630f4a13ddecb2c7c8e9f9db08ef87646f6bb29.zip
logger: Prefix private functions with an underscore.
-rw-r--r--poezio/logger.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/poezio/logger.py b/poezio/logger.py
index 7ac7ad7e..f5973fa7 100644
--- a/poezio/logger.py
+++ b/poezio/logger.py
@@ -56,7 +56,7 @@ class LogMessage(LogItem):
self.nick = nick
-def parse_log_line(msg: str) -> Optional[LogItem]:
+def _parse_log_line(msg: str) -> Optional[LogItem]:
match = re.match(MESSAGE_LOG_RE, msg)
if match:
return LogMessage(*match.groups())
@@ -169,14 +169,14 @@ class Logger:
# do that efficiently, instead of seek()s and read()s which are costly.
with fd:
try:
- lines = get_lines_from_fd(fd, nb=nb)
+ lines = _get_lines_from_fd(fd, nb=nb)
except Exception: # file probably empty
log.error(
'Unable to mmap the log file for (%s)',
filename,
exc_info=True)
return None
- return parse_log_lines(lines)
+ return _parse_log_lines(lines)
def log_message(self,
jid: str,
@@ -193,7 +193,7 @@ class Logger:
"""
if not config.get_by_tabname('use_log', jid):
return True
- logged_msg = build_log_message(nick, msg, date=date, typ=typ)
+ logged_msg = _build_log_message(nick, msg, date=date, typ=typ)
if not logged_msg:
return True
if jid in self._fds.keys():
@@ -260,10 +260,10 @@ class Logger:
return True
-def build_log_message(nick: str,
- msg: str,
- date: Optional[datetime] = None,
- typ: int = 1) -> str:
+def _build_log_message(nick: str,
+ msg: str,
+ date: Optional[datetime] = None,
+ typ: int = 1) -> str:
"""
Create a log message from a nick, a message, optionally a date and type
message types:
@@ -290,7 +290,7 @@ def build_log_message(nick: str,
return logged_msg + ''.join(' %s\n' % line for line in lines)
-def get_lines_from_fd(fd: IO[Any], nb: int = 10) -> List[str]:
+def _get_lines_from_fd(fd: IO[Any], nb: int = 10) -> List[str]:
"""
Get the last log lines from a fileno
"""
@@ -309,7 +309,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]) -> List[Dict[str, Any]]:
"""
Parse raw log lines into poezio log objects
"""
@@ -323,7 +323,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])
idx += 1
if not isinstance(log_item, LogItem):
log.debug('wrong log format? %s', log_item)