Add logging to save_item_metadata for debugging

Track when items are being saved to database to diagnose
why recipes show 0 in stats but effects show correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 20:37:16 +00:00
parent 6c973203fc
commit f7fa683bcf

View File

@@ -641,6 +641,9 @@ async def save_item_metadata(
Returns a dict with the item metadata (compatible with old JSON format).
"""
import logging
logger = logging.getLogger(__name__)
logger.info(f"save_item_metadata: cid={cid[:16] if cid else None}..., actor_id={actor_id}, item_type={item_type}")
# Build metadata JSONB for extra fields
metadata = {}
if tags:
@@ -677,6 +680,7 @@ async def save_item_metadata(
)
item_type_id = row["id"]
logger.info(f"save_item_metadata: Created/updated item_type id={item_type_id} for cid={cid[:16]}...")
# Handle pinning
if pinned and pin_reason: