logging: facade (hand-rolled async worker) + hot-path migration; drop TRUNK_DEBUG

Adds src/misc/Log.h / Log.cpp exposing geulog::{trace,debug,info,warn,error}
(subsystem, args...) with gate-before-format. Seven named loggers
(trunk, satellite, twin, client, mqtt, redis, core) share a mutex-guarded
deque drained by a single background worker thread writing to fd=1.
Levels come from [GLOBAL] LOG=*=warn,trunk=debug,... and are runtime-
settable via /dev/shm/reflector_ctrl (LOG SHOW / LOG sub=lvl / LOG RESET).
Writes continue to fd=1 so LogWriter file/syslog paths are unchanged.

Migrated hot paths only: audio relay, talker start/stop, handshake,
heartbeat, per-client RX, per-frame trunk/satellite/twin relay, plus the
ENOTCONN sendMsg race at ReflectorClient:302 (demoted to debug since it
is per-disconnect noise, not a fault).

Cold paths (startup banners, config validation, TLS/CA diagnostics,
MQTT/Redis publisher lifecycle) remain on raw cout/cerr and move in the
next commit.

TRUNK_DEBUG is removed; a startup warning points at LOG=trunk=debug.
This commit is contained in:
Audric committed 2026-04-18 18:35:51 +02:00
1 parent 59ae728713
commit ccec8f1e95
14 files changed
+1131 -646

No files matched your search

+3
View File
@@ -17,6 +17,9 @@ docker compose -f docker-compose.test.yml up -d --build --wait
echo "=== Running integration tests ==="
python3 test_trunk.py
echo "=== Logging tests ==="
python3 test_logging.py -v || exit 1
echo ""
echo "=================================="
echo "Running TWIN protocol tests"