From: Eric S. Raymond Date: Sun, 26 Aug 2012 11:16:11 +0000 (-0400) Subject: Push some debugging down to the IRC object. X-Git-Tag: 1.0~122 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=91edb3bbbc1d63b961f6b4c31ecf6d0438d67b97;p=irker.git Push some debugging down to the IRC object. --- diff --git a/irclib.py b/irclib.py index a274d31..8b90a00 100644 --- a/irclib.py +++ b/irclib.py @@ -173,8 +173,6 @@ class IRC(object): self.add_global_handler("ping", _ping_ponger, -42) - self.debug(1, "IRC object created") - def server(self): """Creates and returns a ServerConnection object.""" @@ -353,8 +351,8 @@ class IRC(object): def debug(self, level, errmsg): """Display debugging information.""" - #if self.debuglevel >= level: - sys.stderr.write("irclib[%d]: %s\n" % (self.debuglevel, errmsg)) + if self.debuglevel >= level: + sys.stderr.write("irclib[%d]: %s\n" % (self.debuglevel, errmsg)) def _remove_connection(self, connection): """[Internal]""" @@ -446,6 +444,7 @@ class ServerConnection(Connection): def __init__(self, irclibobj): super(ServerConnection, self).__init__(irclibobj) + self.irclibobj = irclibobj self.connected = 0 # Not connected yet. self.socket = None self.ssl = None @@ -495,6 +494,10 @@ class ServerConnection(Connection): self.password = password self.localaddress = localaddress self.localport = localport + + self.irclibobj.debug(1, "connect(server=%s, port=%s, nick=%s)" \ + % (self.server, self.port, self.nickname)) + self.localhost = socket.gethostname() if ipv6: self.socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) diff --git a/irker.py b/irker.py index 91be186..67431a9 100755 --- a/irker.py +++ b/irker.py @@ -40,7 +40,6 @@ class Session(): self.channel = parsed.path.lstrip('/') self.port = int(port) self.server = self.irker.irc.server() - self.irker.debug(1, "connecting: server=%s port=%s name=%s" % (self.servername, self.port, self.name())) self.server.connect(self.servername, self.port, self.name()) Session.count += 1 def enqueue(self, message):