Skip to content

feat: add rotating file logger#34

Open
mutusfa wants to merge 2 commits intoghostwright:mainfrom
mutusfa:feat/file-logging
Open

feat: add rotating file logger#34
mutusfa wants to merge 2 commits intoghostwright:mainfrom
mutusfa:feat/file-logging

Conversation

@mutusfa
Copy link
Copy Markdown

@mutusfa mutusfa commented Apr 4, 2026

Summary

  • Adds src/core/logger.ts: a simple append-only rotating file logger writing to data/logs/phantom.log with 10 MB rotation. Never throws - silently degrades if the directory is unavailable.
  • Wires it into src/index.ts: intercepts console.error/console.warn to mirror into the log file (no changes needed in existing code), and logs the log file path at startup.

Test plan

  • Start phantom and verify data/logs/phantom.log is created
  • Trigger a console.error or console.warn and confirm it appears in the log file
  • Let the log exceed 10 MB and confirm rotation creates phantom.log.1

🤖 Generated with Claude Code

Phantom and others added 2 commits April 4, 2026 00:54
Adds a simple append-only file logger at data/logs/phantom.log with 10 MB
rotation. Never throws - logging silently degrades if the directory can't
be created. Designed to be imported once and used as a singleton.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Intercepts console.error/warn to mirror into the log file so all
existing code gets file logging without needing direct imports.
Logs the log file path at startup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant