"""Shared structured logging utilities."""

import json
import sys


def log_event(message: str, **metadata: object) -> None:
    """Log structured event to stderr.

    Args:
        message: Human-readable log message
        **metadata: Key-value pairs for structured logging
    """
    payload = {"message": message, **metadata}
    print(json.dumps(payload, ensure_ascii=True), file=sys.stderr, flush=True)
