diff options
author | mathieui <mathieui@mathieui.net> | 2011-06-18 18:31:57 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-06-18 18:31:57 +0200 |
commit | afab9e050f59fcd37163aeb93e5cc113c1510546 (patch) | |
tree | 64042290692bf0819667f18afb14045886f864b9 /src/logger.py | |
parent | 53ee85ea6dea76f8f12acc5f5faf4b1171102ea0 (diff) | |
download | poezio-afab9e050f59fcd37163aeb93e5cc113c1510546.tar.gz poezio-afab9e050f59fcd37163aeb93e5cc113c1510546.tar.bz2 poezio-afab9e050f59fcd37163aeb93e5cc113c1510546.tar.xz poezio-afab9e050f59fcd37163aeb93e5cc113c1510546.zip |
Fixes bug #2183
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() |