From eade09d251af5c814a13f078419b7f5a6b8fd9f5 Mon Sep 17 00:00:00 2001 From: kaliko Date: Sat, 15 Nov 2014 11:43:21 +0100 Subject: [PATCH] Allow space in front of prefix traceback sent in debug mode only --- sid/sid.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sid/sid.py b/sid/sid.py index 7c3a5c7..726f7fa 100644 --- a/sid/sid.py +++ b/sid/sid.py @@ -89,7 +89,7 @@ class MUCBot(sleekxmpp.ClientXMPP): def muc_message(self, msg): # ignore message from self - body = msg['body'] + body = msg['body'].strip() mucfrom = msg['mucnic'] if msg['mucnick'] == self.nick: return @@ -107,6 +107,9 @@ class MUCBot(sleekxmpp.ClientXMPP): except Exception as err: reply = ''.join(traceback.format_exc()) self.log.exception('An error occurred processing: {0}: {1}'.format(body, reply)) + self.log.info(self.log.level) + if self.log.level >= 20 or not reply: + return self.send_message(mto=msg['from'].bare, mbody=reply, mtype='groupchat') def start(self, event): -- 2.39.5