Updated the example for the new log setup.
authorChris Jones <christian.jones@sri.com>
Sun, 16 Dec 2012 15:19:45 -0700
changeset 103 f27f78706623
parent 102 872e936f9f3f
child 104 99e03b33b20d
Updated the example for the new log setup.
examples/interact.go
--- a/examples/interact.go	Sun Dec 16 15:15:59 2012 -0700
+++ b/examples/interact.go	Sun Dec 16 15:19:45 2012 -0700
@@ -8,17 +8,26 @@
 	xmpp ".."
 	"flag"
 	"fmt"
-	"io"
 	"log"
 	"os"
 )
 
+type StdLogger struct {
+}
+
+func (s *StdLogger) Log(v ...interface{}) {
+	log.Println(v)
+}
+
+func (s *StdLogger) Logf(fmt string, v ...interface{}) {
+	log.Printf(fmt, v)
+}
+
 func init() {
-	r, w := io.Pipe()
-	go io.Copy(os.Stdout, r)
-	xmpp.Debug = log.New(w, "debug: ", 0)
-	xmpp.Info = log.New(w, "info: ", 0)
-	xmpp.Warn = log.New(w, "warn: ", 0)
+	logger := &StdLogger{}
+	xmpp.Debug = logger
+	xmpp.Info = logger
+	xmpp.Warn = logger
 }
 
 // Demonstrate the API, and allow the user to interact with an XMPP