Skip to content

Add structured logging to core modules #27

Description

@oscarvalenzuelab

Add structured logging to core modules

Summary

The dispatcher, pipelines, and poller currently have zero logging imports. Diagnostic output relies on print / rich which is fine for the CLI surface but useless for production observability — when a launchd service silently misbehaves, there's nothing to grep.

Add Python logging to the core modules so operators can debug without re-running with breakpoints.

Motivation

Acceptance criteria

  • src/dev_sync/core/dispatcher.py uses logging.getLogger(__name__) and logs:
    • INFO at session start (session_id, repo, issue, branch)
    • INFO at each checkpoint state transition
    • WARNING when claude binary resolution falls back
    • ERROR on subprocess failure with exit code and stderr tail
  • src/dev_sync/core/poller.py (or equivalent) logs:
    • INFO when a poll cycle starts/ends
    • INFO when a new issue is claimed
    • WARNING when an issue is skipped (already claimed, missing config, etc.)
  • src/dev_sync/pipelines/dev_pipeline.py and secops_pipeline.py log major lifecycle events at INFO and unexpected states at WARNING/ERROR.
  • CLI entry point configures a sane default handler:
    • Default level INFO; --verbose / -v flag bumps to DEBUG.
    • Format includes timestamp, level, module name.
    • Honors DEV_SYNC_LOG_LEVEL env var if set.
  • Existing user-facing print / rich.print calls in the CLI layer are left alone — this issue is about library logging, not CLI output.
  • No log message contains secrets (tokens, repo paths beyond what's already public, etc.).

Out of scope

  • Replacing rich CLI output with logs.
  • JSON-formatted logs (can be a follow-up if a user asks).
  • Remote log shipping.

Notes

  • Do not assign this issue.
  • Touches src/, so after merge: restart the launchd / systemd services (per docs/operations.md) so they pick up the new code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions