Remove the use of format() in logger functions since they handle it natively.

This commit is contained in:
James Vega 2005-02-01 13:43:57 +00:00
parent 7313ae3b76
commit 68d3b830da
7 changed files with 19 additions and 24 deletions

View File

@ -284,12 +284,11 @@ class Channel(callbacks.Privmsg):
# Check that they're not trying to make us kickban ourself. # Check that they're not trying to make us kickban ourself.
self.log.debug('In kban') self.log.debug('In kban')
if not irc.isNick(bannedNick): if not irc.isNick(bannedNick):
self.log.warning(format('%q tried to kban a non nick: %q', self.log.warning('%q tried to kban a non nick: %q',
msg.prefix, bannedNick)) msg.prefix, bannedNick)
raise callbacks.ArgumentError raise callbacks.ArgumentError
elif bannedNick == irc.nick: elif bannedNick == irc.nick:
self.log.warning(format('%q tried to make me kban myself.', self.log.warning('%q tried to make me kban myself.', msg.prefix)
msg.prefix))
irc.error('I cowardly refuse to kickban myself.') irc.error('I cowardly refuse to kickban myself.')
return return
if not reason: if not reason:
@ -326,8 +325,7 @@ class Channel(callbacks.Privmsg):
# Check (again) that they're not trying to make us kickban ourself. # Check (again) that they're not trying to make us kickban ourself.
if ircutils.hostmaskPatternEqual(banmask, irc.prefix): if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
if ircutils.hostmaskPatternEqual(banmask, irc.prefix): if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
self.log.warning(format('%q tried to make me kban myself.', self.log.warning('%q tried to make me kban myself.',msg.prefix)
msg.prefix))
irc.error('I cowardly refuse to ban myself.') irc.error('I cowardly refuse to ban myself.')
return return
else: else:
@ -350,16 +348,15 @@ class Channel(callbacks.Privmsg):
doBan() doBan()
elif ircdb.checkCapability(msg.prefix, capability): elif ircdb.checkCapability(msg.prefix, capability):
if ircdb.checkCapability(bannedHostmask, capability): if ircdb.checkCapability(bannedHostmask, capability):
self.log.warning( self.log.warning('%s tried to ban %q, but both have %s',
format('%s tried to ban %q, but both have %s', msg.prefix, bannedHostmask, capability)
msg.prefix, bannedHostmask, capability))
irc.error('%s has %s too, you can\'t ban him/her/it.' % irc.error('%s has %s too, you can\'t ban him/her/it.' %
(bannedNick, capability)) (bannedNick, capability))
else: else:
doBan() doBan()
else: else:
self.log.warning(format('%q attempted kban without %s', self.log.warning('%q attempted kban without %s',
msg.prefix, capability)) msg.prefix, capability)
irc.errorNoCapability(capability) irc.errorNoCapability(capability)
exact,nick,user,host exact,nick,user,host
kban = wrap(kban, kban = wrap(kban,

View File

@ -184,7 +184,7 @@ class Math(callbacks.Privmsg):
return str(x) return str(x)
text = self._mathRe.sub(handleMatch, text) text = self._mathRe.sub(handleMatch, text)
try: try:
self.log.info(format('evaluating %q from %s', text, msg.prefix)) self.log.info('evaluating %q from %s', text, msg.prefix)
x = complex(eval(text, self._mathEnv, self._mathEnv)) x = complex(eval(text, self._mathEnv, self._mathEnv))
irc.reply(self._complexToString(x)) irc.reply(self._complexToString(x))
except OverflowError: except OverflowError:
@ -218,7 +218,7 @@ class Math(callbacks.Privmsg):
return return
text = text.replace('lambda', '') text = text.replace('lambda', '')
try: try:
self.log.info(format('evaluating %q from %s', text, msg.prefix)) self.log.info('evaluating %q from %s', text, msg.prefix)
irc.reply(str(eval(text, self._mathEnv, self._mathEnv))) irc.reply(str(eval(text, self._mathEnv, self._mathEnv)))
except OverflowError: except OverflowError:
maxFloat = math.ldexp(0.9999999999999999, 1024) maxFloat = math.ldexp(0.9999999999999999, 1024)

View File

@ -489,8 +489,8 @@ class RichReplyMethods(object):
if 'Raise' not in kwargs: if 'Raise' not in kwargs:
kwargs['Raise'] = True kwargs['Raise'] = True
if isinstance(capability, basestring): # checkCommandCapability! if isinstance(capability, basestring): # checkCommandCapability!
log.warning(format('Denying %s for lacking %q capability.', log.warning('Denying %s for lacking %q capability.',
self.msg.prefix, capability)) self.msg.prefix, capability)
if not self._getConfig(conf.supybot.reply.error.noCapability): if not self._getConfig(conf.supybot.reply.error.noCapability):
v = self._getConfig(conf.supybot.replies.noCapability) v = self._getConfig(conf.supybot.replies.noCapability)
s = self.__makeReply(v % capability, s) s = self.__makeReply(v % capability, s)
@ -1285,8 +1285,8 @@ class PrivmsgRegexp(Privmsg):
r = re.compile(value.__doc__, self.flags) r = re.compile(value.__doc__, self.flags)
self.res.append((r, name)) self.res.append((r, name))
except re.error, e: except re.error, e:
self.log.warning(format('Invalid regexp: %q (%s)', self.log.warning('Invalid regexp: %q (%s)',
value.__doc__, e)) value.__doc__, e)
utils.gen.sortBy(operator.itemgetter(1), self.res) utils.gen.sortBy(operator.itemgetter(1), self.res)
def callCommand(self, name, irc, msg, *L, **kwargs): def callCommand(self, name, irc, msg, *L, **kwargs):

View File

@ -651,8 +651,7 @@ class UsersDictionary(utils.IterableMap):
log.error('Multiple matches found in user database. ' log.error('Multiple matches found in user database. '
'Removing the offending hostmasks.') 'Removing the offending hostmasks.')
for (id, hostmask) in ids.iteritems(): for (id, hostmask) in ids.iteritems():
log.error(format('Removing %q from user %s.', hostmask, log.error('Removing %q from user %s.', hostmask, id)
id))
self.users[id].removeHostmask(hostmask) self.users[id].removeHostmask(hostmask)
raise DuplicateHostmask, 'Ids %r matched.' % ids raise DuplicateHostmask, 'Ids %r matched.' % ids
else: # Not a hostmask, must be a name. else: # Not a hostmask, must be a name.
@ -851,7 +850,7 @@ class IgnoresDB(object):
expiration = 0 expiration = 0
self.add(hostmask, expiration) self.add(hostmask, expiration)
except Exception, e: except Exception, e:
log.error(format('Invalid line in ignores database: %q', line)) log.error('Invalid line in ignores database: %q', line)
fd.close() fd.close()
def flush(self): def flush(self):

View File

@ -169,8 +169,7 @@ class IrcMsgQueue(object):
if msg in self.msgs and \ if msg in self.msgs and \
not conf.supybot.protocols.irc.queueDuplicateMessages(): not conf.supybot.protocols.irc.queueDuplicateMessages():
s = str(msg).strip() s = str(msg).strip()
log.info( log.info('Not adding message %q to queue, already added.', s)
format('Not adding message %q to queue, already added.', s))
return False return False
else: else:
self.msgs.add(msg) self.msgs.add(msg)

View File

@ -48,7 +48,7 @@ def loadPluginModule(name, ignoreDeprecation=False):
try: try:
files.extend(os.listdir(dir)) files.extend(os.listdir(dir))
except EnvironmentError: # OSError, IOError superclass. except EnvironmentError: # OSError, IOError superclass.
log.warning(format('Invalid plugin directory: %s; removing.', dir)) log.warning('Invalid plugin directory: %s; removing.', dir)
conf.supybot.directories.plugins().remove(dir) conf.supybot.directories.plugins().remove(dir)
loweredFiles = map(str.lower, files) loweredFiles = map(str.lower, files)
try: try:

View File

@ -96,7 +96,7 @@ class SupyTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
log.critical('Beginning test case %s', self.id()) log.critical('Beginning test case %s', self.id())
threads = [t.getName() for t in threading.enumerate()] threads = [t.getName() for t in threading.enumerate()]
log.critical(format('Threads: %L', threads)) log.critical('Threads: %L', threads)
unittest.TestCase.setUp(self) unittest.TestCase.setUp(self)
def tearDown(self): def tearDown(self):