summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-12-16 13:42:22 +0100
committermathieui <mathieui@mathieui.net>2012-12-16 13:42:22 +0100
commitcb900858a034059b6264d6911362f9cf1e3ca9e5 (patch)
tree20348305f76a6a72ed644e5998a82ad4dee5dacc
parent344e8c8d6c1fc0fb6d03d2500d88f918fd4d46a8 (diff)
downloadpoezio-cb900858a034059b6264d6911362f9cf1e3ca9e5.tar.gz
poezio-cb900858a034059b6264d6911362f9cf1e3ca9e5.tar.bz2
poezio-cb900858a034059b6264d6911362f9cf1e3ca9e5.tar.xz
poezio-cb900858a034059b6264d6911362f9cf1e3ca9e5.zip
Fix the per-tab options on logs
-rw-r--r--src/logger.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/logger.py b/src/logger.py
index ae2e7a55..6b56738e 100644
--- a/src/logger.py
+++ b/src/logger.py
@@ -49,8 +49,8 @@ class Logger(object):
Check that the directory where we want to log the messages
exists. if not, create it
"""
- if config.get('use_log', 'false') == 'false':
- return None
+ if config.get_by_tabname('use_log', 'false', room) == 'false':
+ return
directory = os.path.join(DATA_HOME, 'logs')
try:
makedirs(directory)
@@ -61,13 +61,13 @@ class Logger(object):
self.fds[room] = fd
return fd
except IOError:
- return None
+ return
def get_logs(self, jid, nb=10):
"""
Get the log history for the given jid
"""
- if config.get_by_tabname('use_log', 'false', jid) == 'false':
+ if config.get_by_tabname('load_log', 10, jid) <= 0:
return
if nb <= 0:
@@ -83,9 +83,11 @@ class Logger(object):
pos = fd.seek(0, 2)
reads = fd.readlines()
while len(reads) < nb + 1:
+ if pos == 0:
+ break
pos -= 100
if pos < 0:
- break
+ pos = 0
fd.seek(pos)
try:
reads = fd.readlines()