summaryrefslogtreecommitdiff
path: root/xmpp/encoder_decoder.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-07-01 20:25:26 +0200
committerxengineering <me@xengineering.eu>2023-07-01 20:25:26 +0200
commit8a0a460089d3ee1a2e1b69991da546034531f8de (patch)
treef13be75af3d694b60d3f63e988f8d3a71a8ee74c /xmpp/encoder_decoder.go
parentad882d60b7dabeb4d4ece6435c2fad9f23ab821f (diff)
downloadlimox-8a0a460089d3ee1a2e1b69991da546034531f8de.tar
limox-8a0a460089d3ee1a2e1b69991da546034531f8de.tar.zst
limox-8a0a460089d3ee1a2e1b69991da546034531f8de.zip
Add log module based XML logging with prefix
The prefix is re-implemented with this commit to distinguish between RX and TX XML. Furthermore the logging is now based on the log module to have the same (e.g. timestamp) prefix as other log messages.
Diffstat (limited to 'xmpp/encoder_decoder.go')
-rw-r--r--xmpp/encoder_decoder.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/xmpp/encoder_decoder.go b/xmpp/encoder_decoder.go
index e7eeaf8..f6958be 100644
--- a/xmpp/encoder_decoder.go
+++ b/xmpp/encoder_decoder.go
@@ -5,7 +5,6 @@ import (
"errors"
"io"
"log"
- "os"
)
type encoderDecoder struct {
@@ -20,11 +19,13 @@ func newEncoderDecoder(s *session) encoderDecoder {
ed.session = s
- w := io.MultiWriter(s.transport, os.Stdout)
+ lw := logger{"TX: "}
+ w := io.MultiWriter(s.transport, lw)
ed.tx = xml.NewEncoder(w)
ed.tx.Indent("", " ")
- r := io.TeeReader(s.transport, os.Stdout)
+ lr := logger{"RX: "}
+ r := io.TeeReader(s.transport, lr)
ed.rx = xml.NewDecoder(r)
return ed