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:
1 parent
59ae728713
commit
ccec8f1e95
14 files changed
+1131
-646
No files matched your search
@@ -67,6 +67,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <AsyncConfig.h>
|
||||
#include <config.h>
|
||||
#include <LogWriter.h>
|
||||
#include <Log.h>
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
@@ -575,6 +576,12 @@ int main(int argc, const char *argv[])
|
||||
cfg.getValue("GLOBAL", "TIMESTAMP_FORMAT", tstamp_format);
|
||||
logwriter.setTimestampFormat(tstamp_format);
|
||||
|
||||
if (!geulog::configure(cfg))
|
||||
{
|
||||
cerr << "*** ERROR: logging facade configuration failed" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cout << PROGRAM_NAME " v" SVXREFLECTOR_VERSION
|
||||
" Copyright (C) 2003-2025 Tobias Blomberg / SM0SVX\n";
|
||||
cout << "Modified with server-to-server trunk support by IW1GEU.\n\n";
|
||||
@@ -623,6 +630,7 @@ int main(int argc, const char *argv[])
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &org_termios);
|
||||
}
|
||||
|
||||
geulog::shutdown();
|
||||
return 0;
|
||||
} /* main */
|
||||
|
||||
|
||||
Reference in new issue
Block a user