ChannelLogger: Allow logging to be disabled on specific channels

This commit is contained in:
James Vega 2009-01-19 21:13:18 +00:00
parent 125e24ceda
commit ce469b0851
2 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2005, Jeremiah Fincher # Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -39,6 +40,8 @@ def configure(advanced):
conf.registerPlugin('ChannelLogger', True) conf.registerPlugin('ChannelLogger', True)
ChannelLogger = conf.registerPlugin('ChannelLogger') ChannelLogger = conf.registerPlugin('ChannelLogger')
conf.registerChannelValue(ChannelLogger, 'enable',
registry.Boolean(True, """Determines whether logging is enabled."""))
conf.registerGlobalValue(ChannelLogger, 'flushImmediately', conf.registerGlobalValue(ChannelLogger, 'flushImmediately',
registry.Boolean(False, """Determines whether channel logfiles will be registry.Boolean(False, """Determines whether channel logfiles will be
flushed anytime they're written to, rather than being buffered by the flushed anytime they're written to, rather than being buffered by the

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2002-2004, Jeremiah Fincher # Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -162,6 +163,8 @@ class ChannelLogger(callbacks.Plugin):
return ircutils.toLower(channel) return ircutils.toLower(channel)
def doLog(self, irc, channel, s, *args): def doLog(self, irc, channel, s, *args):
if not self.registryValue('enable', channel):
return
s = format(s, *args) s = format(s, *args)
channel = self.normalizeChannel(irc, channel) channel = self.normalizeChannel(irc, channel)
log = self.getLog(irc, channel) log = self.getLog(irc, channel)