From ca6ebdce52bba57ca6a13894ce9f401dd4a57f7c Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 1 Dec 2003 11:25:48 +0000 Subject: [PATCH] Added some extra logging of eval'ed expressions. --- plugins/Math.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/Math.py b/plugins/Math.py index c5f7b7c4f..96eef40e3 100644 --- a/plugins/Math.py +++ b/plugins/Math.py @@ -136,6 +136,7 @@ class Math(callbacks.Privmsg): return str(x) text = self._mathRe.sub(handleMatch, text) try: + self.log.info('evaluating %r from %s' % (text, msg.prefix)) x = complex(eval(text, self._mathEnv, self._mathEnv)) irc.reply(msg, self._complexToString(x)) except OverflowError: @@ -222,12 +223,16 @@ class Math(callbacks.Privmsg): irc.error(msg, '%s is not a valid number.' % n) return 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: irc.error(msg, '%s is not a valid units expression.' % unit1) return 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: irc.error(msg, '%s is not a valid units expression.' % unit2) return