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

View File

@ -184,7 +184,7 @@ class Math(callbacks.Privmsg):
return str(x)
text = self._mathRe.sub(handleMatch, text)
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))
irc.reply(self._complexToString(x))
except OverflowError:
@ -218,7 +218,7 @@ class Math(callbacks.Privmsg):
return
text = text.replace('lambda', '')
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)))
except OverflowError:
maxFloat = math.ldexp(0.9999999999999999, 1024)

View File

@ -489,8 +489,8 @@ class RichReplyMethods(object):
if 'Raise' not in kwargs:
kwargs['Raise'] = True
if isinstance(capability, basestring): # checkCommandCapability!
log.warning(format('Denying %s for lacking %q capability.',
self.msg.prefix, capability))
log.warning('Denying %s for lacking %q capability.',
self.msg.prefix, capability)
if not self._getConfig(conf.supybot.reply.error.noCapability):
v = self._getConfig(conf.supybot.replies.noCapability)
s = self.__makeReply(v % capability, s)
@ -1285,8 +1285,8 @@ class PrivmsgRegexp(Privmsg):
r = re.compile(value.__doc__, self.flags)
self.res.append((r, name))
except re.error, e:
self.log.warning(format('Invalid regexp: %q (%s)',
value.__doc__, e))
self.log.warning('Invalid regexp: %q (%s)',
value.__doc__, e)
utils.gen.sortBy(operator.itemgetter(1), self.res)
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. '
'Removing the offending hostmasks.')
for (id, hostmask) in ids.iteritems():
log.error(format('Removing %q from user %s.', hostmask,
id))
log.error('Removing %q from user %s.', hostmask, id)
self.users[id].removeHostmask(hostmask)
raise DuplicateHostmask, 'Ids %r matched.' % ids
else: # Not a hostmask, must be a name.
@ -851,7 +850,7 @@ class IgnoresDB(object):
expiration = 0
self.add(hostmask, expiration)
except Exception, e:
log.error(format('Invalid line in ignores database: %q', line))
log.error('Invalid line in ignores database: %q', line)
fd.close()
def flush(self):

View File

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

View File

@ -48,7 +48,7 @@ def loadPluginModule(name, ignoreDeprecation=False):
try:
files.extend(os.listdir(dir))
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)
loweredFiles = map(str.lower, files)
try:

View File

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