Add --debug flag, dual-mode logging, and auto-run on startup

- logger.py: root-level handlers; normal mode shows only user-facing INFO
  (sync, export, push, MBOX) plus WARNING/ERROR; --debug shows all DEBUG
  with full context (module.func:line). Third-party loggers silenced to WARNING.
- main.py: add --debug CLI flag, call configure_logging() at startup,
  auto-trigger sync on first run or when last sync is overdue by the interval
- database.py: add metadata table with record_sync_time() / get_last_sync_time()
  so startup knows whether a sync is due; sync time recorded on success
- forwarder.py: INFO at push start and push complete with counts
- packager.py: INFO before MBOX conversion begins
- exporter.py: INFO when Proton Mail export starts

https://claude.ai/code/session_01KjaNo9RXevw6x1DjJD8mj6
This commit is contained in:
Claude
2026-03-24 21:54:25 +00:00
parent f021410622
commit 69c685798c
6 changed files with 114 additions and 24 deletions
+6 -1
View File
@@ -47,6 +47,8 @@ def push_emails(
if not emails:
return [], []
log.info("Starting IMAP push of %d email(s) to iCloud...", len(emails))
succeeded: list[str] = []
failed: list[str] = []
@@ -70,8 +72,11 @@ def push_emails(
if succeeded:
mark_delivered(succeeded)
log.info("Marked %d message(s) as delivered.", len(succeeded))
log.info(
"IMAP push complete — %d delivered, %d failed.",
len(succeeded), len(failed),
)
return succeeded, failed