Added a die method.

This commit is contained in:
Jeremy Fincher 2003-09-04 21:36:01 +00:00
parent f65829b768
commit 1d70b27b79

View File

@ -55,6 +55,11 @@ class ChannelLogger(irclib.IrcCallback):
self.lastMsg = None self.lastMsg = None
world.flushers.append(self.flush) 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): def __call__(self, irc, msg):
super(self.__class__, self).__call__(irc, msg) super(self.__class__, self).__call__(irc, msg)
#self.__class__.__bases__[0].__call__(self, irc, msg) #self.__class__.__bases__[0].__call__(self, irc, msg)
@ -68,8 +73,12 @@ class ChannelLogger(irclib.IrcCallback):
self.logs = ircutils.IrcDict() self.logs = ircutils.IrcDict()
def flush(self): def flush(self):
try:
for log in self.logs.itervalues(): for log in self.logs.itervalues():
log.flush() log.flush()
except ValueError, e:
if e.args[0] != 'I/O operation on a closed file':
debug.recoverableException()
def getLog(self, channel): def getLog(self, channel):
if channel in self.logs: if channel in self.logs: