Repository navigation
feat(core): Zero-Copy Logging — ZeroCopyLogger with string_view hot-path and pre-allocated thread-local buffer (v1.6.0, Issue #65) - #4162
Merged
Conversation
…nd pre-allocated thread-local buffer (v1.6.0, Issue #65) Co-authored-by: makr-code <[email protected]>
Copilot
AI
changed the title
[WIP] Implement zero-copy logging for core domain
feat(core): Zero-Copy Logging — ZeroCopyLogger with string_view hot-path and pre-allocated thread-local buffer (v1.6.0)
Mar 13, 2026
makr-code
marked this pull request as ready for review
March 13, 2026 09:04
…st, correct docs (41 tests) Co-authored-by: makr-code <[email protected]>
Copilot
AI
changed the title
feat(core): Zero-Copy Logging — ZeroCopyLogger with string_view hot-path and pre-allocated thread-local buffer (v1.6.0)
feat(core): Zero-Copy Logging — ZeroCopyLogger with string_view hot-path and pre-allocated thread-local buffer (v1.6.0, Issue #65)
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the Zero-Copy Logging roadmap item (v1.6.0) targeting 30–50% reduction in logging hot-path allocations. Adds
ZeroCopyLogger, a drop-inILoggerreplacement backed by two complementary mechanisms:string_viewdispatch and a per-thread pre-allocated format buffer.New:
ZeroCopyLoggerFiles:
include/core/concerns/zero_copy_logger.h·src/core/concerns/zero_copy_logger.cppstring_viewhot-path API —logSV/traceSV/debugSV/infoSV/warnSV/errorSV/criticalSV/logStructuredSVforward directly to spdlog without constructing an intermediatestd::stringlogStructuredSVandlogStructuredreuse astatic thread_local std::stringreserved once per thread atkDefaultBufferCapacity = 4096bytes; subsequent callsclear()(no deallocation) and write into itshouldLog(Level)lets callers skip expensive formatting before it startsILoggercompatibility — allconst std::string&virtual overrides delegate to thestring_viewpath; zero caller-side changes requiredjson_mode_isstd::atomic<bool>sosetJsonMode()is safe to call concurrently with active logging threadsisPiiKey()uses a 128-byte stack buffer andstring_view::find; no heap allocation on the hot pathBuild system
zero_copy_logger.cppadded tocmake/CMakeLists.txt(THEMIS_CORE_SOURCES) andcmake/ModularBuild.cmake.Tests
41 focused tests in
tests/test_zero_copy_logging.cpp→ZeroCopyLoggingFocusedTestsCTest target, covering all acceptance criteria including:*SVlevels +logSVdispatchshouldLogearly-exit (filtered levels produce zero output)password/token/email/ssn/secretkeys in both modesILogger*polymorphic useflush/shutdown/isHealthy)setLevel/getLevelround-triplogSV(8 threads) + concurrentlogStructuredSV(4 threads) — null-sink, no crashConcurrentSetJsonMode_WhileLogging_NoRaceOrCrash— 4 logger threads + 2setJsonModetoggle threads exercising the atomic fixDocumentation
src/core/FUTURE_ENHANCEMENTS.md— Zero-Copy Logging marked ✅ Implementedsrc/core/ROADMAP.md— added to Completed list and Phase 3Type of Change
Testing
📚 Research & Knowledge (wenn applicable)
/docs/research/angelegt?/docs/research/implementation_influence/eingetragen?Relevante Quellen:
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.