From 0b848199b54e8d7c38e30e89539bc2c96473b3f3 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 18 May 2005 04:18:35 +0000 Subject: [PATCH] Fixed some style issues with logging calls. --- plugins/Channel/plugin.py | 6 +++--- plugins/Ctcp/plugin.py | 6 +++--- plugins/Misc/plugin.py | 2 +- plugins/MoobotFactoids/plugin.py | 6 +++--- plugins/Nickometer/plugin.py | 9 ++++----- plugins/Owner/plugin.py | 4 ++-- src/commands.py | 6 +++--- src/irclib.py | 7 +++---- src/world.py | 4 ++-- 9 files changed, 24 insertions(+), 26 deletions(-) diff --git a/plugins/Channel/plugin.py b/plugins/Channel/plugin.py index c25dcd9cc..379d9f8d1 100644 --- a/plugins/Channel/plugin.py +++ b/plugins/Channel/plugin.py @@ -285,9 +285,9 @@ class Channel(callbacks.Plugin): capability = ircdb.makeChannelCapability(channel, 'op') def makeBanmask(bannedHostmask, options): (nick, user, host) = ircutils.splitHostmask(bannedHostmask) - self.log.debug('*** nick: %s' % nick) - self.log.debug('*** user: %s' % user) - self.log.debug('*** host: %s' % host) + self.log.debug('*** nick: %s', nick) + self.log.debug('*** user: %s', user) + self.log.debug('*** host: %s', host) bnick = '*' buser = '*' bhost = '*' diff --git a/plugins/Ctcp/plugin.py b/plugins/Ctcp/plugin.py index 5f6b49665..58714dadf 100644 --- a/plugins/Ctcp/plugin.py +++ b/plugins/Ctcp/plugin.py @@ -92,18 +92,18 @@ class Ctcp(callbacks.PluginRegexp): def ctcpTime(self, irc, msg, match): "\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()) def ctcpFinger(self, irc, msg, match): "\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, 'FINGER Supybot, the best Python IRC bot in existence!') def ctcpSource(self, irc, msg, match): "\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, 'SOURCE http://www.sourceforge.net/projects/supybot/') diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index c219e7971..e62164cf6 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -87,7 +87,7 @@ class Misc(callbacks.Plugin): if tokens: # 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. - 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: bracketConfig = conf.supybot.commands.nested.brackets brackets = conf.get(bracketConfig, channel) diff --git a/plugins/MoobotFactoids/plugin.py b/plugins/MoobotFactoids/plugin.py index a644a4d2b..8a1997cb0 100644 --- a/plugins/MoobotFactoids/plugin.py +++ b/plugins/MoobotFactoids/plugin.py @@ -512,7 +512,7 @@ class MoobotFactoids(callbacks.Plugin): def _lock(self, irc, msg, channel, user, key, locking=True): #self.log.debug('in _lock') - #self.log.debug('id: %s' % id) + #self.log.debug('id: %s', id) id = user.id info = self.db.getFactinfo(channel, key) if not info: @@ -527,8 +527,8 @@ class MoobotFactoids(callbacks.Plugin): irc.error(format('Factoid %q is not locked.', key)) return # Can only lock/unlock own factoids unless you're an admin - #self.log.debug('admin?: %s' % ircdb.checkCapability(id, 'admin')) - #self.log.debug('created_by: %s' % created_by) + #self.log.debug('admin?: %s', ircdb.checkCapability(id, 'admin')) + #self.log.debug('created_by: %s', created_by) if not (ircdb.checkCapability(id, 'admin') or created_by == id): if locking: s = 'lock' diff --git a/plugins/Nickometer/plugin.py b/plugins/Nickometer/plugin.py index 90271aca9..939ab0716 100644 --- a/plugins/Nickometer/plugin.py +++ b/plugins/Nickometer/plugin.py @@ -74,7 +74,7 @@ def numberShifts(s): class Nickometer(callbacks.Plugin): 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 def nickometer(self, irc, msg, args, nick): @@ -145,8 +145,8 @@ class Nickometer(callbacks.Plugin): nick=re.sub('^([^[\]]*)(\[)(.*)(\])([^[\]]*)$', '\1\3\5', nick, 1) if nick == nickInitial: break - self.log.debug('Removed some matching brackets \'%s\' => \'%s\'' % - (nickInitial, nick)); + self.log.debug('Removed some matching brackets %r => %r', + nickInitial, nick) # ... and punish for unmatched brackets unmatched = re.findall('[][(){}]', nick) if len(unmatched) > 0: @@ -224,8 +224,7 @@ class Nickometer(callbacks.Plugin): (originalNick, score_string)) self.log.debug('Calculated lameness score for %s as %s ' - '(raw score was %s)' % - (originalNick, score_string, score)) + '(raw score was %s)', originalNick, score_string, score) nickometer = wrap(nickometer, [additional('text')]) Class = Nickometer diff --git a/plugins/Owner/plugin.py b/plugins/Owner/plugin.py index 5c717a03d..ea51841df 100644 --- a/plugins/Owner/plugin.py +++ b/plugins/Owner/plugin.py @@ -221,7 +221,7 @@ class Owner(callbacks.Plugin): # letter. if name[0].isupper() and not irc.getCallback(name): # This is debug because each log logs its beginning. - self.log.debug('Loading %s.' % name) + self.log.debug('Loading %s.', name) try: m = plugin.loadPluginModule(name, ignoreDeprecation=True) @@ -257,7 +257,7 @@ class Owner(callbacks.Plugin): if s: ignored = ircdb.checkIgnored(msg.prefix) if ignored: - self.log.info('Ignoring command from %s.' % msg.prefix) + self.log.info('Ignoring command from %s.', msg.prefix) return try: tokens = callbacks.tokenize(s, channel=msg.args[0]) diff --git a/src/commands.py b/src/commands.py index 019ac70d8..9865457b9 100644 --- a/src/commands.py +++ b/src/commands.py @@ -78,7 +78,7 @@ class UrlSnarfThread(world.SupyThread): try: super(UrlSnarfThread, self).run() 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): timeout = conf.supybot.snarfThrottle @@ -365,7 +365,7 @@ def getChannelDb(irc, msg, args, state, **kwargs): channel = channelSpecific.link() if not conf.get(channelSpecific.link.allow, channel): 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 else: channel = channelSpecific.getChannelLink(channel) @@ -882,7 +882,7 @@ def wrap(f, specList=[], name=None, **kw): spec = Spec(specList, **kw) def newf(self, irc, msg, args, **kwargs): 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: f(self, irc, msg, args, *state.args, **state.kwargs) except TypeError: diff --git a/src/irclib.py b/src/irclib.py index a6fc18f51..66bce2fd4 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -691,7 +691,6 @@ class Irc(IrcCommandDispatcher): s = 'Ping sent at %s not replied to.' % \ log.timestamp(self.lastping) log.warning(s) - # Let's notify the plugins that we're reconnecting. self.feedMsg(ircmsgs.error(s)) self.driver.reconnect() elif not self.zombie: @@ -703,7 +702,7 @@ class Irc(IrcCommandDispatcher): for callback in reversed(self.callbacks): msg = callback.outFilter(self, msg) if msg is None: - log.debug('%s.outFilter returned None.' % callback.name()) + log.debug('%s.outFilter returned None.', callback.name()) return self.takeMsg() world.debugFlush() if len(str(msg)) > 512: @@ -785,7 +784,7 @@ class Irc(IrcCommandDispatcher): try: m = callback.inFilter(self, msg) if not m: - log.debug('%s.inFilter returned None' % callback.name()) + log.debug('%s.inFilter returned None', callback.name()) return msg = m except: @@ -959,7 +958,7 @@ class Irc(IrcCommandDispatcher): def _reallyDie(self): """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 # we're so close to a release. After 0.80.0 we should remove this # and fix whatever AttributeErrors arise in the drivers themselves. diff --git a/src/world.py b/src/world.py index 3ccaad5d8..67fd40f26 100644 --- a/src/world.py +++ b/src/world.py @@ -139,8 +139,8 @@ def upkeep(): # registry.open(registryFilename) if not dying: log.debug('Regexp cache size: %s', len(sre._cache)) - log.debug('Pattern cache size: %s'%len(ircutils._patternCache)) - log.debug('HostmaskPatternEqual cache size: %s' % + log.debug('Pattern cache size: %s', len(ircutils._patternCache)) + log.debug('HostmaskPatternEqual cache size: %s', len(ircutils._hostmaskPatternEqualCache)) #timestamp = log.timestamp() if doFlush: