summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/configuration.rst18
-rw-r--r--poezio/config.py1
-rw-r--r--poezio/logger.py46
-rw-r--r--poezio/tabs/basetabs.py11
-rw-r--r--poezio/tabs/privatetab.py4
5 files changed, 0 insertions, 80 deletions
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index e394ee03..9619022a 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -892,14 +892,6 @@ Options related to logging.
.. glossary::
:sorted:
- load_log
-
- **Default value:** ``10``
-
- The number of line to preload in a chat buffer when it opens. The lines are
- loaded from the log files.
- ``0`` or a negative value here disable that option.
-
log_dir
**Default value:** ``[empty]``
@@ -1177,16 +1169,6 @@ found.
Ignore private messages sent from this room.
- load_log
-
- **Default value:** ``10``
-
- The number of line to preload in a chat buffer when it opens. The lines are
- loaded from the log files.
- ``0`` or a negative value here disable that option.
-
- No value makes poezio fall back to the global value.
-
password
**Default value:** ``[empty]``
diff --git a/poezio/config.py b/poezio/config.py
index cac2e858..f2160a86 100644
--- a/poezio/config.py
+++ b/poezio/config.py
@@ -90,7 +90,6 @@ DEFAULT_CONFIG = {
'keyfile': '',
'lang': 'en',
'lazy_resize': True,
- 'load_log': 10,
'log_dir': '',
'log_errors': True,
'max_lines_in_memory': 2048,
diff --git a/poezio/logger.py b/poezio/logger.py
index ca1f059f..da68a3a4 100644
--- a/poezio/logger.py
+++ b/poezio/logger.py
@@ -132,52 +132,6 @@ class Logger:
'Unable to open the log file (%s)', filename, exc_info=True)
return None
- def get_logs(self, jid: str,
- nb: int = 10) -> Optional[List[Dict[str, Any]]]:
- """
- Get the nb last messages from the log history for the given jid.
- Note that a message may be more than one line in these files, so
- this function is a little bit more complicated than “read the last
- nb lines”.
- """
- if config.get_by_tabname('load_log', jid) <= 0:
- return None
-
- if not config.get_by_tabname('use_log', jid):
- return None
-
- if nb <= 0:
- return None
-
- self._check_and_create_log_dir(jid, open_fd=False)
-
- filename = log_dir / jid
- try:
- fd = filename.open('rb')
- except FileNotFoundError:
- log.info('Non-existing log file (%s)', filename, exc_info=True)
- return None
- except OSError:
- log.error(
- 'Unable to open the log file (%s)', filename, exc_info=True)
- return None
- if not fd:
- return None
-
- # read the needed data from the file, we just search nb messages by
- # searching "\nM" nb times from the end of the file. We use mmap to
- # do that efficiently, instead of seek()s and read()s which are costly.
- with fd:
- try:
- 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, jid)
-
def log_message(self,
jid: str,
nick: str,
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index e7a49073..f2da8469 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -519,14 +519,6 @@ class ChatTab(Tab):
self.update_commands()
self.update_keys()
- # Get the logs
- log_nb = config.get('load_log')
- logs = self.load_logs(log_nb)
-
- if logs:
- for message in logs:
- self._text_buffer.add_message(**message)
-
@property
def name(self) -> str:
if self._name is not None:
@@ -562,9 +554,6 @@ class ChatTab(Tab):
def general_jid(self) -> JID:
raise NotImplementedError
- def load_logs(self, log_nb: int) -> Optional[List[Dict[str, Any]]]:
- return logger.get_logs(self.jid.bare, log_nb)
-
def log_message(self,
txt: str,
nickname: str,
diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py
index 6229cd1c..f01476fa 100644
--- a/poezio/tabs/privatetab.py
+++ b/poezio/tabs/privatetab.py
@@ -104,10 +104,6 @@ class PrivateTab(OneToOneTab):
def remove_information_element(plugin_name):
del PrivateTab.additional_information[plugin_name]
- def load_logs(self, log_nb):
- logs = logger.get_logs(self.jid.full.replace('/', '\\'), log_nb)
- return logs
-
def log_message(self, txt, nickname, time=None, typ=1):
"""
Log the messages in the archives.