Merge pull request #540 from esplinr/master

ChannelLogger: Improvements to file handling.
This commit is contained in:
Valentin Lorentz 2014-01-15 23:11:26 -08:00
commit 1f2d51dfc5

View File

@ -132,7 +132,7 @@ class ChannelLogger(callbacks.Plugin):
for (channel, log) in logs.items(): for (channel, log) in logs.items():
if self.registryValue('rotateLogs', channel): if self.registryValue('rotateLogs', channel):
name = self.getLogName(channel) name = self.getLogName(channel)
if name != log.name: if name != os.path.basename(log.name):
log.close() log.close()
del logs[channel] del logs[channel]
@ -149,7 +149,7 @@ class ChannelLogger(callbacks.Plugin):
try: try:
name = self.getLogName(channel) name = self.getLogName(channel)
logDir = self.getLogDir(irc, channel) logDir = self.getLogDir(irc, channel)
log = open(os.path.join(logDir, name), 'a') log = open(os.path.join(logDir, name), encoding='utf-8', mode='a')
logs[channel] = log logs[channel] = log
return log return log
except IOError: except IOError: