mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
Merge pull request #540 from esplinr/master
ChannelLogger: Improvements to file handling.
This commit is contained in:
commit
1f2d51dfc5
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user