From 342364d134ad4bbf64b1d0f077fb74fd0d86b454 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 1 Jul 2023 20:50:10 +0200 Subject: 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. --- xmpp/encoder_decoder.go | 6 +++--- 1 file 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) -- cgit v1.2.3-70-g09d2