From: Eric S. Raymond Date: Sun, 26 Aug 2012 10:40:38 +0000 (-0400) Subject: DEbug the debug code :-) X-Git-Tag: 1.0~125 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f5c3fc432454d2e456ba7f0911c02eeb6853f6a5;p=irker.git DEbug the debug code :-) --- diff --git a/irker.py b/irker.py index bf4e064..28fe59a 100755 --- a/irker.py +++ b/irker.py @@ -67,8 +67,8 @@ class Session(): class Irker: "Persistent IRC multiplexer." def __init__(self, debuglevel=0): - self.debuglevel = 0 - self.irc = irclib.IRC() + self.debuglevel = debuglevel + self.irc = irclib.IRC(self.debuglevel-1) thread = threading.Thread(target=self.irc.process_forever) self.irc._thread = thread thread.daemon = True @@ -79,8 +79,8 @@ class Irker: sys.stderr.write("irker: " + errmsg + "\n") def debug(self, level, errmsg): "Debugging information." - if level >= self.debuglevel: - sys.stderr.write("irker: " + errmsg + "\n") + if self.debuglevel >= level: + sys.stderr.write("irker[%d]: %s\n" % (self.debuglevel, errmsg)) def run(self, ifp, await=True): "Accept JSON relay requests from specified stream." while True: