mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Added command timing to the verbose log.
This commit is contained in:
parent
58902cd8fd
commit
89fa7855da
@ -250,7 +250,10 @@ class IrcObjectProxy:
|
|||||||
(self.msg.nick, name))
|
(self.msg.nick, name))
|
||||||
return
|
return
|
||||||
command = getattr(callback, name)
|
command = getattr(callback, name)
|
||||||
|
start = time.time()
|
||||||
callback.callCommand(command, self, self.msg, self.args)
|
callback.callCommand(command, self, self.msg, self.args)
|
||||||
|
elapsed = time.time() - start
|
||||||
|
debug.msg('%s took %s seconds.' % (name, elapsed), 'verbose')
|
||||||
else:
|
else:
|
||||||
self.args.insert(0, name)
|
self.args.insert(0, name)
|
||||||
self.reply(self.msg, '[%s]' % ' '.join(self.args))
|
self.reply(self.msg, '[%s]' % ' '.join(self.args))
|
||||||
@ -293,8 +296,9 @@ class IrcObjectProxy:
|
|||||||
|
|
||||||
class CommandThread(threading.Thread):
|
class CommandThread(threading.Thread):
|
||||||
def __init__(self, command, irc, msg, args):
|
def __init__(self, command, irc, msg, args):
|
||||||
name = '%s.%s with args %r' % (command.im_class.__name__,
|
self.commandName = command.im_func.func_name
|
||||||
command.im_func.func_name, args)
|
self.className = command.im_class.__name__
|
||||||
|
name = '%s.%s with args %r' % (self.className, self.commandName, args)
|
||||||
threading.Thread.__init__(self, target=command, name=name,
|
threading.Thread.__init__(self, target=command, name=name,
|
||||||
args=(irc, msg, args))
|
args=(irc, msg, args))
|
||||||
self.irc = irc
|
self.irc = irc
|
||||||
@ -303,7 +307,11 @@ class CommandThread(threading.Thread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
|
start = time.time()
|
||||||
threading.Thread.run(self)
|
threading.Thread.run(self)
|
||||||
|
elapsed = time.time() - start
|
||||||
|
debug.msg('%s took %s seconds.' % \
|
||||||
|
(self.commandName, elapsed), 'verbose')
|
||||||
except Error, e:
|
except Error, e:
|
||||||
self.irc.reply(self.msg, debug.exnToString(e))
|
self.irc.reply(self.msg, debug.exnToString(e))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
Loading…
Reference in New Issue
Block a user