mirror of https://github.com/Mikaela/Limnoria.git
ChannelLogger: Fix NameError on 'irc'.
This commit is contained in:
parent
b65d78518c
commit
de9cea89cf
|
@ -89,13 +89,13 @@ class ChannelLogger(callbacks.Plugin):
|
||||||
if e.args[0] != 'I/O operation on a closed file':
|
if e.args[0] != 'I/O operation on a closed file':
|
||||||
self.log.exception('Odd exception:')
|
self.log.exception('Odd exception:')
|
||||||
|
|
||||||
def logNameTimestamp(self, channel):
|
def logNameTimestamp(self, network, channel):
|
||||||
format = self.registryValue('filenameTimestamp', channel, irc.network)
|
format = self.registryValue('filenameTimestamp', channel, network)
|
||||||
return time.strftime(format)
|
return time.strftime(format)
|
||||||
|
|
||||||
def getLogName(self, channel):
|
def getLogName(self, network, channel):
|
||||||
if self.registryValue('rotateLogs', channel, irc.network):
|
if self.registryValue('rotateLogs', channel, network):
|
||||||
return '%s.%s.log' % (channel, self.logNameTimestamp(channel))
|
return '%s.%s.log' % (channel, self.logNameTimestamp(network, channel))
|
||||||
else:
|
else:
|
||||||
return '%s.log' % channel
|
return '%s.log' % channel
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class ChannelLogger(callbacks.Plugin):
|
||||||
for (irc, logs) in self.logs.items():
|
for (irc, logs) in self.logs.items():
|
||||||
for (channel, log) in list(logs.items()):
|
for (channel, log) in list(logs.items()):
|
||||||
if self.registryValue('rotateLogs', channel, irc.network):
|
if self.registryValue('rotateLogs', channel, irc.network):
|
||||||
name = self.getLogName(channel)
|
name = self.getLogName(irc.network, channel)
|
||||||
if name != os.path.basename(log.name):
|
if name != os.path.basename(log.name):
|
||||||
log.close()
|
log.close()
|
||||||
del logs[channel]
|
del logs[channel]
|
||||||
|
@ -135,7 +135,7 @@ class ChannelLogger(callbacks.Plugin):
|
||||||
return logs[channel]
|
return logs[channel]
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
name = self.getLogName(channel)
|
name = self.getLogName(irc.network, channel)
|
||||||
logDir = self.getLogDir(irc, channel)
|
logDir = self.getLogDir(irc, channel)
|
||||||
log = open(os.path.join(logDir, name), encoding='utf-8', mode='a')
|
log = open(os.path.join(logDir, name), encoding='utf-8', mode='a')
|
||||||
logs[channel] = log
|
logs[channel] = log
|
||||||
|
@ -168,7 +168,7 @@ class ChannelLogger(callbacks.Plugin):
|
||||||
if minisix.PY2:
|
if minisix.PY2:
|
||||||
s = s.decode('utf8', 'ignore')
|
s = s.decode('utf8', 'ignore')
|
||||||
log.write(s)
|
log.write(s)
|
||||||
if self.registryValue('flushImmediately', irc.network):
|
if self.registryValue('flushImmediately'):
|
||||||
log.flush()
|
log.flush()
|
||||||
|
|
||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
|
|
Loading…
Reference in New Issue