Use the new logging setup from the example program.
// Copyright 2011 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.packagemainimport(xmpp"..""flag""fmt""io""log""os")funcinit(){r,w:=io.Pipe()goio.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)}// Demonstrate the API, and allow the user to interact with an XMPP// server via the terminal.funcmain(){varjidxmpp.JIDflag.Var(&jid,"jid","JID to log in as")varpw*string=flag.String("pw","","password")flag.Parse()ifjid.Domain==""||*pw==""{flag.Usage()os.Exit(2)}c,err:=xmpp.NewClient(&jid,*pw,nil)iferr!=nil{log.Fatalf("NewClient(%v): %v",jid,err)}deferclose(c.Out)err=c.StartSession(true,&xmpp.Presence{})iferr!=nil{log.Fatalf("StartSession: %v",err)}roster:=xmpp.Roster(c)fmt.Printf("%d roster entries:\n",len(roster))fori,entry:=range(roster){fmt.Printf("%d: %v\n",i,entry)}gofunc(ch<-chanxmpp.Stanza){forobj:=rangech{fmt.Printf("s: %v\n",obj)}fmt.Println("done reading")}(c.In)p:=make([]byte,1024)for{nr,_:=os.Stdin.Read(p)ifnr==0{break}s:=string(p)stan,err:=xmpp.ParseStanza(s)iferr==nil{c.Out<-stan}else{fmt.Printf("Parse error: %v\n",err)break}}fmt.Println("done sending")}