summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-05-10 21:47:02 +0200
committerxengineering <me@xengineering.eu>2023-05-10 21:47:02 +0200
commit2662bcd350c51ee3a0db2a7750fe4551de23fb04 (patch)
treefc44b2b9c7075726b26335b03aa57c26c58eda57
parentbe69cea228f4674862b8c25f11f044f82dbc13bb (diff)
downloadlimox-2662bcd350c51ee3a0db2a7750fe4551de23fb04.tar
limox-2662bcd350c51ee3a0db2a7750fe4551de23fb04.tar.zst
limox-2662bcd350c51ee3a0db2a7750fe4551de23fb04.zip
Implement pretty-printed server side XML logging
-rw-r--r--xmpp.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/xmpp.go b/xmpp.go
index 6f24c86..6540ae5 100644
--- a/xmpp.go
+++ b/xmpp.go
@@ -1,7 +1,6 @@
package main
import (
- "io"
"os"
"crypto/tls"
"crypto/x509"
@@ -34,15 +33,13 @@ func (l *Limox) xmpp(jid string, pwd string) {
return
}
- multiw := io.MultiWriter(conn, os.Stdout)
- enc := xml.NewEncoder(multiw)
+ enc := xml.NewEncoder(conn)
receiver := make(chan xml.Token)
termination := make(chan bool)
go func() {
quit := false
- tee := io.TeeReader(conn, os.Stdout)
- dec := xml.NewDecoder(tee)
+ dec := xml.NewDecoder(conn)
for {
select {
case <-termination:
@@ -60,6 +57,8 @@ func (l *Limox) xmpp(jid string, pwd string) {
log.Println("Done!")
}()
+ dbg := xml.NewEncoder(os.Stdout)
+
end := sendStreamStart(enc, jid)
l.XmppEvents <- XmppConnect
@@ -72,10 +71,12 @@ func (l *Limox) xmpp(jid string, pwd string) {
termination <- true
closing = true
default:
- //log.Fatalf("Unknown GuiEvent '%d'!\n", ev)
+ log.Fatalf("Unknown GuiEvent '%d'!\n", ev)
}
- case <-receiver:
- // ignoring incoming XML tokens for now ...
+ case rx := <-receiver:
+ dbg.Indent("S: ", " ")
+ dbg.EncodeToken(rx)
+ dbg.Flush()
}
if closing {