3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

make server logging consistent with other logs

This commit is contained in:
Jeremy Latt 2014-02-18 10:22:40 -08:00
parent 58517ad4e8
commit 4f106e7d3e
3 changed files with 12 additions and 13 deletions

View File

@ -118,9 +118,6 @@ func (client *Client) connectionClosed() {
}
func (client *Client) Destroy() {
if DEBUG_CLIENT {
log.Printf("%s: destroying", client)
}
// clean up self
client.socket.Close()

View File

@ -121,19 +121,23 @@ func newListener(config ListenerConfig) (net.Listener, error) {
func (s *Server) listen(config ListenerConfig) {
listener, err := newListener(config)
if err != nil {
log.Fatal("Server.Listen: ", err)
log.Fatal(s, "listen error: ", err)
}
log.Print("Server.Listen: listening on ", config.Address)
if DEBUG_SERVER {
log.Printf("%s listening on %s", s, config.Address)
}
for {
conn, err := listener.Accept()
if err != nil {
log.Print("Server.Accept: ", err)
if DEBUG_SERVER {
log.Printf("%s accept error: %s", s, err)
}
continue
}
if DEBUG_SERVER {
log.Print("Server.Accept: ", conn.RemoteAddr())
log.Printf("%s accept: %s", s, conn.RemoteAddr())
}
s.conns <- conn

View File

@ -76,9 +76,6 @@ func (socket *Socket) readLines() {
close(socket.receive)
socket.Close()
if DEBUG_NET {
log.Printf("%s closed", socket)
}
}
func (socket *Socket) writeLines() {
@ -105,13 +102,14 @@ func (socket *Socket) writeLines() {
}
}
if DEBUG_NET {
log.Printf("%s closing", socket)
}
if done {
socket.conn.Close()
}
if DEBUG_NET {
log.Printf("%s closed", socket)
}
// read incoming messages and discard to avoid hangs
for {
select {