xmpp.go
changeset 102 872e936f9f3f
parent 100 24231ff0016c
child 105 aa895dfae3f6
--- a/xmpp.go	Sun Dec 16 14:37:43 2012 -0700
+++ b/xmpp.go	Sun Dec 16 15:15:59 2012 -0700
@@ -12,7 +12,6 @@
 	"errors"
 	"fmt"
 	"io"
-	"log"
 	"net"
 	"sync"
 )
@@ -36,15 +35,6 @@
 	clientSrv = "xmpp-client"
 )
 
-var (
-	// If any of these are non-nil when NewClient() is called,
-	// they will be used to log messages of the indicated
-	// severity.
-	Warn *log.Logger
-	Info *log.Logger
-	Debug *log.Logger
-)
-
 // This channel may be used as a convenient way to generate a unique
 // id for an iq, message, or presence stanza.
 var Id <-chan string
@@ -250,13 +240,13 @@
 		}
 		buf.Write(c[:n])
 		if c[0] == '\n' || c[0] == '>' {
-			Debug.Print(buf)
+			Debug.Log(buf)
 			buf.Reset()
 		}
 	}
 	leftover := buf.String()
 	if leftover != "" {
-		Debug.Print(buf)
+		Debug.Log(buf)
 	}
 }
 
@@ -279,12 +269,12 @@
 	f := func(st Stanza) bool {
 		iq, ok := st.(*Iq)
 		if !ok {
-			Warnf("iq reply not iq; can't start session")
+			Warn.Logf("iq reply not iq; can't start session")
 			ch <- errors.New("bad session start reply")
 			return false
 		}
 		if iq.Type == "error" {
-			Warnf("Can't start session: %v", iq)
+			Warn.Logf("Can't start session: %v", iq)
 			ch <- iq.Error
 			return false
 		}
@@ -319,21 +309,3 @@
 	cl.filterOut <- out
 	return <-cl.filterIn
 }
-
-func Warnf(msg string, args ...interface{}) {
-	if Warn != nil {
-		Warn.Printf(msg, args)
-	}
-}
-
-func Infof(msg string, args ...interface{}) {
-	if Info != nil {
-		Info.Printf(msg, args)
-	}
-}
-
-func Debugf(msg string, args ...interface{}) {
-	if Debug != nil {
-		Debug.Printf(msg, args)
-	}
-}