Add ReadLoop() debugging via Connection.Debug.
This commit is contained in:
parent
f997fc841a
commit
80f67f76b5
10
irc.go
10
irc.go
@ -69,6 +69,10 @@ func (irc *Connection) readLoop() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if irc.Debug {
|
||||||
|
irc.Log.Printf("<-- %s\n", strings.TrimSpace(msg))
|
||||||
|
}
|
||||||
|
|
||||||
irc.lastMessage = time.Now()
|
irc.lastMessage = time.Now()
|
||||||
msg = msg[:len(msg)-2] //Remove \r\n
|
msg = msg[:len(msg)-2] //Remove \r\n
|
||||||
event := &Event{Raw: msg}
|
event := &Event{Raw: msg}
|
||||||
@ -97,10 +101,6 @@ 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ func (irc *Connection) writeLoop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if irc.Debug {
|
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
|
// Set a write deadline based on the time out
|
||||||
|
@ -38,7 +38,6 @@ 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
|
||||||
|
Loading…
Reference in New Issue
Block a user