From 27b342a5e7c2ac922b60b42263eb6725b3dbb9c7 Mon Sep 17 00:00:00 2001 From: rouggy Date: Wed, 26 Aug 2026 22:07:11 +0200 Subject: [PATCH] chore(tci): cap the diagnostic logging per message type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The transmit meters are asked for four times a second while keyed, so logging every arrival would fill an evening's log — and a diagnostic that fills a log is one that gets switched off instead of read. Twenty of each is enough to tell an answer from a silence, which is all it is for. --- internal/cat/tci_panel.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/internal/cat/tci_panel.go b/internal/cat/tci_panel.go index d4f064c..566d420 100644 --- a/internal/cat/tci_panel.go +++ b/internal/cat/tci_panel.go @@ -88,6 +88,8 @@ type TCIPanelState struct { // arrives alongside. type tciPanel struct { st TCIPanelState + // logged counts what has been written per message type — see handlePanel. + logged map[string]int } // handlePanel takes the messages the console cares about. @@ -112,12 +114,21 @@ func (t *TCI) handlePanel(name string, get func(int) string, args string) bool { // this is our reading or its doing, and no amount of reasoning will. switch name { case "mute", "sql_enable", "sql_level", "tx_power", "tx_swr", "tune": - // Logged on arrival so an ANSWER can be told from a silence. The - // transmit meters are asked for four times a second while keyed and the - // log showed only the asking, which proves nothing on its own: a reply - // that arrived and failed to parse looks exactly like one that never - // came. - debugLog.Printf("TCI: %s:%s", name, args) + // Logged on arrival so an ANSWER can be told from a SILENCE: the log + // showed the transmit meters being asked for and nothing coming back, + // which on its own proves nothing — a reply that arrived and failed to + // parse leaves exactly the same trace as one that never came. + // + // Capped per message type. The meters are asked for four times a second + // while transmitting, and a diagnostic that fills an evening's log is + // one that gets switched off instead of read. + if t.panel.logged == nil { + t.panel.logged = map[string]int{} + } + if n := t.panel.logged[name]; n < 20 { + t.panel.logged[name] = n + 1 + debugLog.Printf("TCI: %s:%s", name, args) + } } switch name { case "protocol":