From 7b01c62e07612a123f3ffe94583f51099e470c3b Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 20 Oct 2014 20:03:16 +0200 Subject: Change the API of Config.get_by_tabname Make the "default" parameter optional and thus move it to the end of the command with the other optional parameters. And change all the calls. --- src/logger.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/logger.py') diff --git a/src/logger.py b/src/logger.py index 7ed0692f..53ec4311 100644 --- a/src/logger.py +++ b/src/logger.py @@ -78,7 +78,7 @@ class Logger(object): Check that the directory where we want to log the messages exists. if not, create it """ - if not config.get_by_tabname('use_log', True, room): + if not config.get_by_tabname('use_log', room): return try: makedirs(log_dir) @@ -106,10 +106,10 @@ class Logger(object): this function is a little bit more complicated than “read the last nb lines”. """ - if config.get_by_tabname('load_log', 10, jid) <= 0: + if config.get_by_tabname('load_log', jid) <= 0: return - if not config.get_by_tabname('use_log', True, jid): + if not config.get_by_tabname('use_log', jid): return if nb <= 0: @@ -197,7 +197,7 @@ class Logger(object): return True jid = str(jid).replace('/', '\\') - if not config.get_by_tabname('use_log', False, jid): + if not config.get_by_tabname('use_log', jid): return True if jid in self.fds.keys(): fd = self.fds[jid] @@ -245,7 +245,7 @@ class Logger(object): """ Log a roster change """ - if not config.get_by_tabname('use_log', False, jid): + if not config.get_by_tabname('use_log', jid): return True self.check_and_create_log_dir('', open_fd=False) if not self.roster_logfile: -- cgit v1.2.3 From f9734cde5623aaf701e222b00d5eebdf7a152772 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 20 Oct 2014 21:04:14 +0200 Subject: Remove the (sometimes wrong) default values in the config.get() calls --- src/logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/logger.py') diff --git a/src/logger.py b/src/logger.py index 53ec4311..85c7a746 100644 --- a/src/logger.py +++ b/src/logger.py @@ -50,7 +50,7 @@ class Logger(object): and also log the conversations to logfiles """ def __init__(self): - self.logfile = config.get('logfile', 'logs') + self.logfile = config.get('logfile') self.roster_logfile = None # a dict of 'groupchatname': file-object (opened) self.fds = dict() -- cgit v1.2.3