Skip to content

Structured file logging #34

Description

@PyXiion

Origin of idea

loguru logs to stderr only. No persistent log files. Debugging a user-reported issue requires them to reproduce while watching terminal output. LOGURU_LEVEL=DEBUG is set only in dev mode.

Suggestion / proposed solution

Add logger.add() in _app.py:

  • Write to config_dir()/logs/pxmodrim.log with rotation (10 MB, keep 5)
  • JSON serialization option for machine parsing
  • Always write INFO+ to file; DEBUG to file when --debug flag or env var set
  • Include process ID, timestamp, module:line in format
  • Add "Open logs folder" action to Help menu
    Related: issue More useful logs #15 (More useful logs) for content; this issue is for infrastructure.

Alternatives considered

  • Structured logging framework (structlog) — heavier, loguru already sufficient

Additional context

_app.py:28-55 has exception hooks wired to loguru. LOGURU_LEVEL=DEBUG in justfile.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions