]> jfr.im git - erebus.git/commitdiff
adding timestamp to debug messages
authorzonidjan <redacted>
Mon, 20 Jun 2016 15:10:42 +0000 (10:10 -0500)
committerzonidjan <redacted>
Mon, 20 Jun 2016 15:10:42 +0000 (10:10 -0500)
bot.py

diff --git a/bot.py b/bot.py
index b65a5ae5ddf716d38bfc20fc871e0f476ef4142b..fa4eaf1b6eb123a77a0b6c780db3dde2164a202f 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -3,7 +3,7 @@
 # Erebus IRC bot - Author: John Runyon
 # "Bot" and "BotConnection" classes (handling a specific "arm")
 
-import socket, sys
+import socket, sys, time
 
 #bots = {'erebus': bot.Bot(nick='Erebus', user='erebus', bind='', server='irc.quakenet.org', port=6667, realname='Erebus')}
 class Bot(object):
@@ -205,7 +205,8 @@ class BotConnection(object):
 
        #TODO: rewrite send() to queue
        def send(self, line):
-               print self.parent.nick, '[O]', str(line)
+               print "%05.3f %s [O] %s" % (time.time() % 100000, self.parent.nick, line)
+#              print (time.time() % 1466400000), self.parent.nick, '[O]', str(line)
                self._write(line)
 
        def _write(self, line):
@@ -217,7 +218,8 @@ class BotConnection(object):
 
                while "\r\n" in self.buffer:
                        pieces = self.buffer.split("\r\n", 1)
-                       print self.parent.nick, '[I]', pieces[0]
+                       print "%05.3f %s [I] %s" % (time.time() % 100000, self.parent.nick, pieces[0])
+#                      print (time.time() % 1460000000), self.parent.nick, '[I]', pieces[0]
                        lines.append(pieces[0])
                        self.buffer = pieces[1]