Add a 'VerboseReadLoop' option.

Troubleshooting responses from the IRC server becomes easier when
you can actually see the raw responses. This change adds a
'VerboseReadLoop' member to the Connection struct. When set to
true, the raw messages sent from the server will be placed into
the standard log for review. This message is printed before
evaluating any callbacks.
This commit is contained in:
Ant Zucaro 2014-10-04 08:20:58 -04:00
parent 066134263e
commit f997fc841a
2 changed files with 4 additions and 0 deletions

3
irc.go
View File

@ -97,6 +97,9 @@ func (irc *Connection) readLoop() {
} }
/* XXX: len(args) == 0: args should be empty */ /* XXX: len(args) == 0: args should be empty */
if irc.VerboseReadLoop {
irc.Log.Println(event.Raw)
}
irc.RunCallbacks(event) irc.RunCallbacks(event)
} }

View File

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