mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Added some extra logging of eval'ed expressions.
This commit is contained in:
parent
cada17ebb3
commit
ca6ebdce52
@ -136,6 +136,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('evaluating %r from %s' % (text, msg.prefix))
|
||||||
x = complex(eval(text, self._mathEnv, self._mathEnv))
|
x = complex(eval(text, self._mathEnv, self._mathEnv))
|
||||||
irc.reply(msg, self._complexToString(x))
|
irc.reply(msg, self._complexToString(x))
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
@ -222,12 +223,16 @@ class Math(callbacks.Privmsg):
|
|||||||
irc.error(msg, '%s is not a valid number.' % n)
|
irc.error(msg, '%s is not a valid number.' % n)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
u1 = eval(unit1.lower(), self._convertEnv, self._convertEnv)
|
unit1 = unit1.lower()
|
||||||
|
self.log.info('evaluating %r from %s' % (unit1, msg.prefix))
|
||||||
|
u1 = eval(unit1, self._convertEnv, self._convertEnv)
|
||||||
except:
|
except:
|
||||||
irc.error(msg, '%s is not a valid units expression.' % unit1)
|
irc.error(msg, '%s is not a valid units expression.' % unit1)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
u2 = eval(unit2.lower(), self._convertEnv, self._convertEnv)
|
unit2 = unit2.lower()
|
||||||
|
self.log.info('evaluating %r from %s' % (unit2, msg.prefix))
|
||||||
|
u2 = eval(unit2, self._convertEnv, self._convertEnv)
|
||||||
except:
|
except:
|
||||||
irc.error(msg, '%s is not a valid units expression.' % unit2)
|
irc.error(msg, '%s is not a valid units expression.' % unit2)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user