Eliminate unnecessary closing of the log file.

Name returns a string that is the log file name: the channel plus the timestamp.
But on my system log.name returns the fully qualified path to the currently open file. This is because log is a file handle, so if you declare it with a path, it will be included in the name.
On systems were logging is not in the current directory, the two will never match, and the file is closed and then reopened.
Only taking the basename solves this problem.
This commit is contained in:
Richard Esplin 2014-01-15 16:15:11 -07:00
parent b31ce87472
commit ba0ba71bf4
1 changed files with 1 additions and 1 deletions

View File

@ -132,7 +132,7 @@ class ChannelLogger(callbacks.Plugin):
for (channel, log) in logs.items():
if self.registryValue('rotateLogs', channel):
name = self.getLogName(channel)
if name != log.name:
if name != os.path.basename(log.name):
log.close()
del logs[channel]