From 80f67f76b5d864f383494565ed2bd615a2df2b4d Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sun, 5 Oct 2014 08:56:52 -0400 Subject: [PATCH] Add ReadLoop() debugging via Connection.Debug. --- irc.go | 10 +++++----- irc_struct.go | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/irc.go b/irc.go index 2aa6c40..3e5b717 100644 --- a/irc.go +++ b/irc.go @@ -69,6 +69,10 @@ func (irc *Connection) readLoop() { break } + if irc.Debug { + irc.Log.Printf("<-- %s\n", strings.TrimSpace(msg)) + } + irc.lastMessage = time.Now() msg = msg[:len(msg)-2] //Remove \r\n event := &Event{Raw: msg} @@ -97,10 +101,6 @@ func (irc *Connection) readLoop() { } /* XXX: len(args) == 0: args should be empty */ - if irc.VerboseReadLoop { - irc.Log.Println(event.Raw) - } - irc.RunCallbacks(event) } } @@ -122,7 +122,7 @@ func (irc *Connection) writeLoop() { } if irc.Debug { - irc.Log.Printf("--> %s\n", b) + irc.Log.Printf("--> %s\n", strings.TrimSpace(b)) } // Set a write deadline based on the time out diff --git a/irc_struct.go b/irc_struct.go index 6f7a259..161c6a2 100644 --- a/irc_struct.go +++ b/irc_struct.go @@ -38,7 +38,6 @@ type Connection struct { lastMessage time.Time VerboseCallbackHandler bool - VerboseReadLoop bool Log *log.Logger stopped bool