summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-07-01 20:50:10 +0200
committerxengineering <me@xengineering.eu>2023-07-01 20:50:10 +0200
commit342364d134ad4bbf64b1d0f077fb74fd0d86b454 (patch)
treed93a4820aae706950b1fbd0cc25555c6082cd4ef
parent8a0a460089d3ee1a2e1b69991da546034531f8de (diff)
downloadlimox-342364d134ad4bbf64b1d0f077fb74fd0d86b454.tar
limox-342364d134ad4bbf64b1d0f077fb74fd0d86b454.tar.zst
limox-342364d134ad4bbf64b1d0f077fb74fd0d86b454.zip
Improve prefix and disable indent
The prefix has now more visual contrast to the XML content due to its own bracket style. Furthermore the indent for the TX stream was disabled. Indent is a nice thing but it just makes sense if both streams are indented identically. Since the RX stream received from the current development server has no indent and also no newlines it is better to turn it of completely. This might change in the future with structured logging (with the new slog package) or command line flags to toggle this behaviour. Re-encoding of the RX stream could also be an option but should stay one because it alters the RX stream and might hide errors during debugging.
-rw-r--r--xmpp/encoder_decoder.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/xmpp/encoder_decoder.go b/xmpp/encoder_decoder.go
index f6958be..d7951b3 100644
--- a/xmpp/encoder_decoder.go
+++ b/xmpp/encoder_decoder.go
@@ -19,12 +19,12 @@ func newEncoderDecoder(s *session) encoderDecoder {
ed.session = s
- lw := logger{"TX: "}
+ lw := logger{"[TX] "}
w := io.MultiWriter(s.transport, lw)
ed.tx = xml.NewEncoder(w)
- ed.tx.Indent("", " ")
+ ed.tx.Indent("", "")
- lr := logger{"RX: "}
+ lr := logger{"[RX] "}
r := io.TeeReader(s.transport, lr)
ed.rx = xml.NewDecoder(r)