From 0da02a3e6d13c1626e6422f6d7ead3848036a146 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Sun, 15 Mar 2026 12:53:46 +0100 Subject: Add sequence numbers to log stream protocol and tests for drop detection TcpLogStreamSink now stamps each message with a monotonic sequence number. LogStreamListener tracks the expected sequence per session and emits a synthetic "dropped" notice when gaps appear. Includes tests covering basic delivery, multi-line splitting, drop detection, and contiguous sequencing. Also simplifies LogMessage::s_DefaultPoint to a single entry. --- src/zencore/include/zencore/logging/logmsg.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/zencore') diff --git a/src/zencore/include/zencore/logging/logmsg.h b/src/zencore/include/zencore/logging/logmsg.h index 1d8b6b1b7..45b0e38fb 100644 --- a/src/zencore/include/zencore/logging/logmsg.h +++ b/src/zencore/include/zencore/logging/logmsg.h @@ -44,22 +44,14 @@ struct LogMessage mutable size_t ColorRangeEnd = 0; private: - static constexpr LogPoint s_DefaultPoints[LogLevelCount] = { - {{}, Trace, {}}, - {{}, Debug, {}}, - {{}, Info, {}}, - {{}, Warn, {}}, - {{}, Err, {}}, - {{}, Critical, {}}, - {{}, Off, {}}, - }; + static constexpr LogPoint s_DefaultPoint{{}, Off, {}}; std::string_view m_LoggerName; LogLevel m_Level = Off; std::chrono::system_clock::time_point m_Time; SourceLocation m_Source; std::string_view m_Payload; - const LogPoint* m_Point = &s_DefaultPoints[Off]; + const LogPoint* m_Point = &s_DefaultPoint; int m_ThreadId = 0; }; -- cgit v1.2.3