From 1a5b74415036b605e62406aec189839c7451b97c Mon Sep 17 00:00:00 2001 From: raylu Date: Wed, 13 Oct 2010 14:57:36 -0400 Subject: [PATCH] Make printing in recv/send optional --- irc/connection.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/irc/connection.go b/irc/connection.go index 1e67081..abcdc82 100644 --- a/irc/connection.go +++ b/irc/connection.go @@ -27,7 +27,9 @@ type Conn struct { Err chan os.Error // Set this to true to disable flood protection and false to re-enable - Flood bool; + Flood bool + + debug bool // Event handler mapping events map[string][]func(*Conn, *Line) @@ -150,7 +152,9 @@ func (conn *Conn) send() { break } conn.io.Flush() - fmt.Println("-> " + line) + if conn.debug { + fmt.Println("-> " + line) + } } } @@ -165,7 +169,9 @@ func (conn *Conn) recv() { } // chop off \r\n s = s[0 : len(s)-2] - fmt.Println("<- " + s) + if conn.debug { + fmt.Println("<- " + s) + } line := &Line{Raw: s} if s[0] == ':' {