From 05c47ab65e73b16887b7c7a1eb31acf6d364ef41 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 20 Mar 2026 23:48:32 +0000 Subject: Add logging :-o Adds virtual log function, real implementation writes to syslog. Test implementation writes to BOOST_TEST_MESSAGE, perf implementation discards. Replaces existing prints to stderr and adds logs to all key points. --- src/webstat_logger_main.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/webstat_logger_main.cpp') diff --git a/src/webstat_logger_main.cpp b/src/webstat_logger_main.cpp index 39d794a..3eaa9f0 100644 --- a/src/webstat_logger_main.cpp +++ b/src/webstat_logger_main.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace { [[nodiscard]] @@ -17,6 +18,19 @@ namespace { } return uts; } + + class MainIngestor : public WebStat::Ingestor { + using Ingestor::Ingestor; + + void + log(int level, const char * msgfmt, ...) const override + { + va_list args; + va_start(args, msgfmt); + vsyslog(level, msgfmt, args); + va_end(args); + } + }; } #define LEXICAL_CAST_DURATION(UNIT) \ @@ -87,7 +101,7 @@ main(int argc, char ** argv) po::notify(optVars); try { - WebStat::Ingestor {getHostDetail(), std::move(settings)}.ingestLog(stdin); + MainIngestor {getHostDetail(), std::move(settings)}.ingestLog(stdin); return EXIT_SUCCESS; } catch (const std::exception & excp) { -- cgit v1.3