From 1d70b27b791a5b8b9236ecd92500661d851a7a1c Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 4 Sep 2003 21:36:01 +0000 Subject: [PATCH] Added a die method. --- plugins/ChannelLogger.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/ChannelLogger.py b/plugins/ChannelLogger.py index c42dbd8a8..30f56bb78 100644 --- a/plugins/ChannelLogger.py +++ b/plugins/ChannelLogger.py @@ -55,6 +55,11 @@ class ChannelLogger(irclib.IrcCallback): self.lastMsg = None world.flushers.append(self.flush) + def die(self): + for log in self.logs.itervalues(): + log.close() + world.flushers.remove(self.flush) + def __call__(self, irc, msg): super(self.__class__, self).__call__(irc, msg) #self.__class__.__bases__[0].__call__(self, irc, msg) @@ -68,8 +73,12 @@ class ChannelLogger(irclib.IrcCallback): self.logs = ircutils.IrcDict() def flush(self): - for log in self.logs.itervalues(): - log.flush() + try: + for log in self.logs.itervalues(): + log.flush() + except ValueError, e: + if e.args[0] != 'I/O operation on a closed file': + debug.recoverableException() def getLog(self, channel): if channel in self.logs: