Skip to content

[codex] Add MemoryLogger subscriber callbacks#119

Merged
NewYaroslav merged 5 commits into
mainfrom
codex/memory-logger-subscriber-api
Jun 8, 2026
Merged

[codex] Add MemoryLogger subscriber callbacks#119
NewYaroslav merged 5 commits into
mainfrom
codex/memory-logger-subscriber-api

Conversation

@NewYaroslav

@NewYaroslav NewYaroslav commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ILogSubscriber support to MemoryLogger, including add/remove callback registration and post-write LogRecordView notification outside the backend mutex.
  • Add callback/thread-safety coverage for MemoryLogger and register the new test in CMake.
  • Update MemoryLogger and MdbxLogger examples plus README/Doxygen docs to show the shared ILogReader/ILogSubscriber macro API for fallback-friendly stored-log access.
  • Add guides/ci.md and link it from the agent guide index so future AI-agent changes account for CI toolchain parity, sanitizer/timing tests, and log-based CI triage.

Why

MemoryLogger can now be used as a functional fallback for MdbxLogger in code that consumes stored logs through LOGIT_READ_* and live updates through LOGIT_ADD_LOG_CALLBACK / LOGIT_REMOVE_LOG_CALLBACK.

The added agent guidance captures the Windows/MSVC failure mode found during CI and turns it into a reusable checklist for future generated changes.

Validation

  • ctest --test-dir build-mingw -R memory_logger_callback_test --output-on-failure
  • ctest --test-dir build-mingw -R "(memory_logger_backend_test|memory_logger_concurrency_test|memory_logger_integration_test|include_memory_logger_nhr_test)$" --output-on-failure
  • ctest --test-dir build-mingw -R "(include_loggers_nhr_test|include_quickstart_test|logger_snapshot_read_path_test|logger_clear_api_test)$" --output-on-failure
  • Built and ran example_logit_memory_logger.
  • Built and ran example_logit_mdbx_logger with LOGIT_WITH_MDBX=OFF and with LOGIT_WITH_MDBX=ON using bundled MDBX submodules.
  • git diff --check

Note: MDBX example build emits a dependency warning from mdbx-containers about deprecated std::wstring_convert; it is unrelated to this change.

Implement ILogSubscriber support for MemoryLogger so it can share live record callbacks with MdbxLogger through the common stored-log API. Callbacks receive LogRecordView snapshots after records are written and outside the backend mutex.

Update MemoryLogger and MdbxLogger examples to demonstrate LOGIT_READ_* and LOGIT_*_LOG_CALLBACK macros, document the shared reader/subscriber contract, and add focused callback/thread-safety coverage.
MSVC does not allow the writer lambda in memory_logger_callback_test to use logs_per_writer unless it is explicitly captured. Capture the loop bound by value so the Windows build compiles while preserving the thread-safety test semantics.
@NewYaroslav NewYaroslav marked this pull request as ready for review June 7, 2026 23:03
Document how agents should account for the CI toolchain matrix, minimum CMake and C++ versions, sanitizer and timing-sensitive tests, and real-log CI failure triage.

Link the new playbook from AGENTS.md and the guides index so future build, test, and CI changes have a focused checklist.
Replace the misleading LogRecordView name with LogRecordSnapshot without keeping an alias, making the owning snapshot semantics explicit in the public API and docs.

Document subscriber callback ordering and removal semantics, make MdbxLogger callback dispatch deterministic by registration id, and add MDBX callback ordering coverage.
Explain why MemoryLogger captures the owning LogRecordSnapshot before moving the entry into the buffer while still dispatching callbacks only after the buffer update completes.
@NewYaroslav NewYaroslav merged commit 0ebf546 into main Jun 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant