forked from External/ergo
move to channel-based logging
This commit is contained in:
parent
77d053ccac
commit
e15f47c766
9 changed files with 80 additions and 71 deletions
|
|
@ -3,7 +3,6 @@ package irc
|
|||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
|
|
@ -38,9 +37,7 @@ func (socket *Socket) String() string {
|
|||
|
||||
func (socket *Socket) Close() {
|
||||
socket.conn.Close()
|
||||
if DEBUG_NET {
|
||||
log.Printf("%s closed", socket)
|
||||
}
|
||||
Log.debug.Printf("%s closed", socket)
|
||||
}
|
||||
|
||||
func (socket *Socket) readLines(commands chan<- Command) {
|
||||
|
|
@ -57,9 +54,7 @@ func (socket *Socket) readLines(commands chan<- Command) {
|
|||
if len(line) == 0 {
|
||||
continue
|
||||
}
|
||||
if DEBUG_NET {
|
||||
log.Printf("%s → %s", socket, line)
|
||||
}
|
||||
Log.debug.Printf("%s → %s", socket, line)
|
||||
|
||||
msg, err := ParseCommand(line)
|
||||
if err != nil {
|
||||
|
|
@ -87,16 +82,14 @@ func (socket *Socket) Write(line string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
if DEBUG_NET {
|
||||
log.Printf("%s ← %s", socket, line)
|
||||
}
|
||||
Log.debug.Printf("%s ← %s", socket, line)
|
||||
return
|
||||
}
|
||||
|
||||
func (socket *Socket) isError(err error, dir rune) bool {
|
||||
if err != nil {
|
||||
if DEBUG_NET && (err != io.EOF) {
|
||||
log.Printf("%s %c error: %s", socket, dir, err)
|
||||
if err != io.EOF {
|
||||
Log.debug.Printf("%s %c error: %s", socket, dir, err)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue