diff options
Diffstat (limited to 'src/logger.py')
-rw-r--r-- | src/logger.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/logger.py b/src/logger.py index ad615f9b..d87eaa6b 100644 --- a/src/logger.py +++ b/src/logger.py @@ -34,6 +34,7 @@ class Logger(object): """ def __init__(self): self.logfile = config.get('logfile', 'logs') + self.roster_logfile = None # a dict of 'groupchatname': file-object (opened) self.fds = dict() @@ -81,4 +82,13 @@ class Logger(object): else: fd.flush() # TODO do something better here? + def log_roster_change(self, jid, message): + if not self.roster_logfile: + try: + self.roster_logfile = open(os.path.join(DATA_HOME, 'logs', 'roster.log'), 'a') + except IOError: + return + self.roster_logfile.write('%s %s %s\n' % (datetime.now().strftime('%d-%m-%y [%H:%M:%S]'), jid, message)) + self.roster_logfile.flush() + logger = Logger() |