diff options
author | xengineering <me@xengineering.eu> | 2023-05-10 21:47:02 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-05-10 21:47:02 +0200 |
commit | 2662bcd350c51ee3a0db2a7750fe4551de23fb04 (patch) | |
tree | fc44b2b9c7075726b26335b03aa57c26c58eda57 /xmpp.go | |
parent | be69cea228f4674862b8c25f11f044f82dbc13bb (diff) | |
download | limox-2662bcd350c51ee3a0db2a7750fe4551de23fb04.tar limox-2662bcd350c51ee3a0db2a7750fe4551de23fb04.tar.zst limox-2662bcd350c51ee3a0db2a7750fe4551de23fb04.zip |
Implement pretty-printed server side XML logging
Diffstat (limited to 'xmpp.go')
-rw-r--r-- | xmpp.go | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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 { |