Add ReadLoop() debugging via Connection.Debug.

This commit is contained in:
Ant Zucaro 2014-10-05 08:56:52 -04:00
parent f997fc841a
commit 80f67f76b5
2 changed files with 5 additions and 6 deletions

10
irc.go
View File

@ -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

View File

@ -38,7 +38,6 @@ type Connection struct {
lastMessage time.Time
VerboseCallbackHandler bool
VerboseReadLoop bool
Log *log.Logger
stopped bool