Feature/playground memcube log structured logs #509
Merged
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.
Description
Summary: Implement structured logging for memcube events with new event types (addMessage, addMemory, updateMemory, mergeMemory, scheduleMemory). Replace simple text logs with structured JSON format containing
memcube_log_content,metadata,memcube_name, andmemory_lenfields. Use halfwidth punctuation for i18n compatibility and ensure backend sends complete data for frontend processing.Fix: N/A (feature implementation based on PRD requirements)
Docs Issue/PR: N/A
Reviewer: @CaralHsi @tangg555 @lijicode
Changes
Core Implementation
Schema Enhancement (
message_schemas.py): Added new fields for structured loggingmemcube_log_content: Array of structured content itemsmetadata: Detailed metadata for each memorymemcube_name: Display name (UserMemCube/PublicMemCube)memory_len: Count of items involved in eventEvent Creation (
scheduler_logger.py): Newcreate_event_log()method for structured eventsEvent Emission (
general_scheduler.py): Integrated structured logging in workflowsLabel Mapping (
base_scheduler.py): Normalize old labels to new event typesBackward Compatibility
log_contentfield preservedBranch Strategy
This PR is re-developed from the latest
devbranch (after commit #507) to avoid merge conflicts. The original development was on an older branch forked from commit #497, but was redone cleanly on the currentdevto ensure compatibility with recent changes (log rotation, redis_scheduler, etc.).Checklist:
I have performed a self-review of my own code | 我已自行检查了自己的代码
I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人