Fixed some style issues with logging calls.

This commit is contained in:
Jeremy Fincher 2005-05-18 04:18:35 +00:00
parent a1e707caa2
commit 0b848199b5
9 changed files with 24 additions and 26 deletions

View File

@ -285,9 +285,9 @@ class Channel(callbacks.Plugin):
capability = ircdb.makeChannelCapability(channel, 'op') capability = ircdb.makeChannelCapability(channel, 'op')
def makeBanmask(bannedHostmask, options): def makeBanmask(bannedHostmask, options):
(nick, user, host) = ircutils.splitHostmask(bannedHostmask) (nick, user, host) = ircutils.splitHostmask(bannedHostmask)
self.log.debug('*** nick: %s' % nick) self.log.debug('*** nick: %s', nick)
self.log.debug('*** user: %s' % user) self.log.debug('*** user: %s', user)
self.log.debug('*** host: %s' % host) self.log.debug('*** host: %s', host)
bnick = '*' bnick = '*'
buser = '*' buser = '*'
bhost = '*' bhost = '*'

View File

@ -92,18 +92,18 @@ class Ctcp(callbacks.PluginRegexp):
def ctcpTime(self, irc, msg, match): def ctcpTime(self, irc, msg, match):
"\x01TIME\x01" "\x01TIME\x01"
self.log.info('Received CTCP TIME from %s' % msg.prefix) self.log.info('Received CTCP TIME from %s', msg.prefix)
self._reply(irc, msg, 'TIME %s' % time.ctime()) self._reply(irc, msg, 'TIME %s' % time.ctime())
def ctcpFinger(self, irc, msg, match): def ctcpFinger(self, irc, msg, match):
"\x01FINGER\x01" "\x01FINGER\x01"
self.log.info('Received CTCP FINGER from %s' % msg.prefix) self.log.info('Received CTCP FINGER from %s', msg.prefix)
self._reply(irc, msg, self._reply(irc, msg,
'FINGER Supybot, the best Python IRC bot in existence!') 'FINGER Supybot, the best Python IRC bot in existence!')
def ctcpSource(self, irc, msg, match): def ctcpSource(self, irc, msg, match):
"\x01SOURCE\x01" "\x01SOURCE\x01"
self.log.info('Received CTCP SOURCE from %s' % msg.prefix) self.log.info('Received CTCP SOURCE from %s', msg.prefix)
self._reply(irc, msg, self._reply(irc, msg,
'SOURCE http://www.sourceforge.net/projects/supybot/') 'SOURCE http://www.sourceforge.net/projects/supybot/')

View File

@ -87,7 +87,7 @@ class Misc(callbacks.Plugin):
if tokens: if tokens:
# echo [] will get us an empty token set, but there's no need # echo [] will get us an empty token set, but there's no need
# to log this in that case anyway, it being a nested command. # to log this in that case anyway, it being a nested command.
self.log.info('Not replying to %s, not a command.' % tokens[0]) self.log.info('Not replying to %s, not a command.', tokens[0])
if irc.nested: if irc.nested:
bracketConfig = conf.supybot.commands.nested.brackets bracketConfig = conf.supybot.commands.nested.brackets
brackets = conf.get(bracketConfig, channel) brackets = conf.get(bracketConfig, channel)

View File

@ -512,7 +512,7 @@ class MoobotFactoids(callbacks.Plugin):
def _lock(self, irc, msg, channel, user, key, locking=True): def _lock(self, irc, msg, channel, user, key, locking=True):
#self.log.debug('in _lock') #self.log.debug('in _lock')
#self.log.debug('id: %s' % id) #self.log.debug('id: %s', id)
id = user.id id = user.id
info = self.db.getFactinfo(channel, key) info = self.db.getFactinfo(channel, key)
if not info: if not info:
@ -527,8 +527,8 @@ class MoobotFactoids(callbacks.Plugin):
irc.error(format('Factoid %q is not locked.', key)) irc.error(format('Factoid %q is not locked.', key))
return return
# Can only lock/unlock own factoids unless you're an admin # Can only lock/unlock own factoids unless you're an admin
#self.log.debug('admin?: %s' % ircdb.checkCapability(id, 'admin')) #self.log.debug('admin?: %s', ircdb.checkCapability(id, 'admin'))
#self.log.debug('created_by: %s' % created_by) #self.log.debug('created_by: %s', created_by)
if not (ircdb.checkCapability(id, 'admin') or created_by == id): if not (ircdb.checkCapability(id, 'admin') or created_by == id):
if locking: if locking:
s = 'lock' s = 'lock'

View File

@ -74,7 +74,7 @@ def numberShifts(s):
class Nickometer(callbacks.Plugin): class Nickometer(callbacks.Plugin):
def punish(self, damage, reason): def punish(self, damage, reason):
self.log.debug('%s lameness points awarded: %s' % (damage, reason)) self.log.debug('%s lameness points awarded: %s', damage, reason)
return damage return damage
def nickometer(self, irc, msg, args, nick): def nickometer(self, irc, msg, args, nick):
@ -145,8 +145,8 @@ class Nickometer(callbacks.Plugin):
nick=re.sub('^([^[\]]*)(\[)(.*)(\])([^[\]]*)$', '\1\3\5', nick, 1) nick=re.sub('^([^[\]]*)(\[)(.*)(\])([^[\]]*)$', '\1\3\5', nick, 1)
if nick == nickInitial: if nick == nickInitial:
break break
self.log.debug('Removed some matching brackets \'%s\' => \'%s\'' % self.log.debug('Removed some matching brackets %r => %r',
(nickInitial, nick)); nickInitial, nick)
# ... and punish for unmatched brackets # ... and punish for unmatched brackets
unmatched = re.findall('[][(){}]', nick) unmatched = re.findall('[][(){}]', nick)
if len(unmatched) > 0: if len(unmatched) > 0:
@ -224,8 +224,7 @@ class Nickometer(callbacks.Plugin):
(originalNick, score_string)) (originalNick, score_string))
self.log.debug('Calculated lameness score for %s as %s ' self.log.debug('Calculated lameness score for %s as %s '
'(raw score was %s)' % '(raw score was %s)', originalNick, score_string, score)
(originalNick, score_string, score))
nickometer = wrap(nickometer, [additional('text')]) nickometer = wrap(nickometer, [additional('text')])
Class = Nickometer Class = Nickometer

View File

@ -221,7 +221,7 @@ class Owner(callbacks.Plugin):
# letter. # letter.
if name[0].isupper() and not irc.getCallback(name): if name[0].isupper() and not irc.getCallback(name):
# This is debug because each log logs its beginning. # This is debug because each log logs its beginning.
self.log.debug('Loading %s.' % name) self.log.debug('Loading %s.', name)
try: try:
m = plugin.loadPluginModule(name, m = plugin.loadPluginModule(name,
ignoreDeprecation=True) ignoreDeprecation=True)
@ -257,7 +257,7 @@ class Owner(callbacks.Plugin):
if s: if s:
ignored = ircdb.checkIgnored(msg.prefix) ignored = ircdb.checkIgnored(msg.prefix)
if ignored: if ignored:
self.log.info('Ignoring command from %s.' % msg.prefix) self.log.info('Ignoring command from %s.', msg.prefix)
return return
try: try:
tokens = callbacks.tokenize(s, channel=msg.args[0]) tokens = callbacks.tokenize(s, channel=msg.args[0])

View File

@ -78,7 +78,7 @@ class UrlSnarfThread(world.SupyThread):
try: try:
super(UrlSnarfThread, self).run() super(UrlSnarfThread, self).run()
except utils.web.Error, e: except utils.web.Error, e:
log.debug('Exception in urlSnarfer: %s' % utils.exnToString(e)) log.debug('Exception in urlSnarfer: %s', utils.exnToString(e))
class SnarfQueue(ircutils.FloodQueue): class SnarfQueue(ircutils.FloodQueue):
timeout = conf.supybot.snarfThrottle timeout = conf.supybot.snarfThrottle
@ -365,7 +365,7 @@ def getChannelDb(irc, msg, args, state, **kwargs):
channel = channelSpecific.link() channel = channelSpecific.link()
if not conf.get(channelSpecific.link.allow, channel): if not conf.get(channelSpecific.link.allow, channel):
log.warning('channelSpecific.link is globally set to %s, but ' log.warning('channelSpecific.link is globally set to %s, but '
'%s disallows linking to its db.' % (channel, channel)) '%s disallowed linking to its db.', channel, channel)
raise raise
else: else:
channel = channelSpecific.getChannelLink(channel) channel = channelSpecific.getChannelLink(channel)
@ -882,7 +882,7 @@ def wrap(f, specList=[], name=None, **kw):
spec = Spec(specList, **kw) spec = Spec(specList, **kw)
def newf(self, irc, msg, args, **kwargs): def newf(self, irc, msg, args, **kwargs):
state = spec(irc, msg, args, stateAttrs={'cb': self, 'log': self.log}) state = spec(irc, msg, args, stateAttrs={'cb': self, 'log': self.log})
self.log.debug('State before call: %s' % state) self.log.debug('State before call: %s', state)
try: try:
f(self, irc, msg, args, *state.args, **state.kwargs) f(self, irc, msg, args, *state.args, **state.kwargs)
except TypeError: except TypeError:

View File

@ -691,7 +691,6 @@ class Irc(IrcCommandDispatcher):
s = 'Ping sent at %s not replied to.' % \ s = 'Ping sent at %s not replied to.' % \
log.timestamp(self.lastping) log.timestamp(self.lastping)
log.warning(s) log.warning(s)
# Let's notify the plugins that we're reconnecting.
self.feedMsg(ircmsgs.error(s)) self.feedMsg(ircmsgs.error(s))
self.driver.reconnect() self.driver.reconnect()
elif not self.zombie: elif not self.zombie:
@ -703,7 +702,7 @@ class Irc(IrcCommandDispatcher):
for callback in reversed(self.callbacks): for callback in reversed(self.callbacks):
msg = callback.outFilter(self, msg) msg = callback.outFilter(self, msg)
if msg is None: if msg is None:
log.debug('%s.outFilter returned None.' % callback.name()) log.debug('%s.outFilter returned None.', callback.name())
return self.takeMsg() return self.takeMsg()
world.debugFlush() world.debugFlush()
if len(str(msg)) > 512: if len(str(msg)) > 512:
@ -785,7 +784,7 @@ class Irc(IrcCommandDispatcher):
try: try:
m = callback.inFilter(self, msg) m = callback.inFilter(self, msg)
if not m: if not m:
log.debug('%s.inFilter returned None' % callback.name()) log.debug('%s.inFilter returned None', callback.name())
return return
msg = m msg = m
except: except:
@ -959,7 +958,7 @@ class Irc(IrcCommandDispatcher):
def _reallyDie(self): def _reallyDie(self):
"""Makes the Irc object die. Dead.""" """Makes the Irc object die. Dead."""
log.info('Irc object for %s dying.' % self.network) log.info('Irc object for %s dying.', self.network)
# XXX This hasattr should be removed, I'm just putting it here because # XXX This hasattr should be removed, I'm just putting it here because
# we're so close to a release. After 0.80.0 we should remove this # we're so close to a release. After 0.80.0 we should remove this
# and fix whatever AttributeErrors arise in the drivers themselves. # and fix whatever AttributeErrors arise in the drivers themselves.

View File

@ -139,8 +139,8 @@ def upkeep():
# registry.open(registryFilename) # registry.open(registryFilename)
if not dying: if not dying:
log.debug('Regexp cache size: %s', len(sre._cache)) log.debug('Regexp cache size: %s', len(sre._cache))
log.debug('Pattern cache size: %s'%len(ircutils._patternCache)) log.debug('Pattern cache size: %s', len(ircutils._patternCache))
log.debug('HostmaskPatternEqual cache size: %s' % log.debug('HostmaskPatternEqual cache size: %s',
len(ircutils._hostmaskPatternEqualCache)) len(ircutils._hostmaskPatternEqualCache))
#timestamp = log.timestamp() #timestamp = log.timestamp()
if doFlush: if doFlush: