summaryrefslogtreecommitdiff
path: root/src/logger.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-03-31 16:33:10 +0200
committermathieui <mathieui@mathieui.net>2013-03-31 16:33:10 +0200
commite8fae6f24cf783de7f17f85084d53a55d14e9f89 (patch)
treed199fc687516f3d0f13b9588376c4cfc60a0fe88 /src/logger.py
parentf58cd588c293f504b0c8858b207d30fa4c89b5b1 (diff)
downloadpoezio-e8fae6f24cf783de7f17f85084d53a55d14e9f89.tar.gz
poezio-e8fae6f24cf783de7f17f85084d53a55d14e9f89.tar.bz2
poezio-e8fae6f24cf783de7f17f85084d53a55d14e9f89.tar.xz
poezio-e8fae6f24cf783de7f17f85084d53a55d14e9f89.zip
Fix #2275, ref #2229
- Refactor the message handlers to be more readable - Add a group_corrections tab-specific option (#2229) - Fix issues with /correct in private tabs and conversation tabs
Diffstat (limited to 'src/logger.py')
-rw-r--r--src/logger.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/logger.py b/src/logger.py
index 6b56738e..8b4b1d3c 100644
--- a/src/logger.py
+++ b/src/logger.py
@@ -97,7 +97,7 @@ class Logger(object):
logs = reads[-nb:]
return logs
- def log_message(self, jid, nick, msg):
+ def log_message(self, jid, nick, msg, date=None):
"""
log the message in the appropriate jid's file
"""
@@ -109,10 +109,14 @@ class Logger(object):
return
try:
msg = clean_text(msg)
+ if date is None:
+ str_time = datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')
+ else:
+ str_time = date.strftime('%d-%m-%y [%H:%M:%S] ')
if nick:
- fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+nick+': '+msg+'\n')
+ fd.write(''.join((str_time, nick, ': ', msg, '\n')))
else:
- fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+'* '+msg+'\n')
+ fd.write(''.join((str_time, '* ', msg, '\n')))
except IOError:
pass
else: