Skip to content

Conversation

@jmgilman
Copy link
Collaborator

Summary

  • Add internal/logging package with infrastructure for capturing and reading session output logs
  • Add PathManager for log file path management (~/.local/share/headjack/logs/<instance-id>/<session-id>.log)
  • Implement TeeWriter and SessionWriters for capturing stdout/stderr while displaying to terminal
  • Implement Reader with ReadAll, ReadLastN (tail), Follow, and FollowWithHistory modes
  • Add Logs field to StorageConfig with default path

Test plan

  • Unit tests for PathManager (9 tests)
  • Unit tests for TeeWriter/SessionWriters (10 tests)
  • Unit tests for Reader including partial line handling (8 tests)
  • All 27 logging package tests passing
  • Config tests updated and passing

Resolves JMG-8

🤖 Generated with Claude Code

jmgilman and others added 2 commits December 31, 2025 11:28
Add infrastructure for capturing and reading session output logs:

- Create logging package with PathManager for log file path management
  (~/.local/share/headjack/logs/<instance-id>/<session-id>.log)
- Implement TeeWriter for capturing stdout/stderr while displaying to terminal
- Implement log Reader with ReadAll, ReadLastN (tail), and Follow modes
- Add SessionWriters for combined stdout/stderr logging to single file
- Add Logs field to StorageConfig with default path

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When ReadBytes('\n') encounters a partial line (data without trailing
newline), it returns the data along with io.EOF. Previously, this data
was discarded when EOF was detected. Now we write any data received
before checking for EOF, matching tail -f behavior.

Added test to verify partial lines are captured correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@linear
Copy link

linear bot commented Dec 31, 2025

@jmgilman jmgilman merged commit 53bf9a3 into master Dec 31, 2025
@jmgilman jmgilman deleted the joshuagilman/jmg-8-session-logging-infrastructure branch December 31, 2025 19:50
jmgilman added a commit that referenced this pull request Jan 3, 2026
Current behavior:
N/A - new feature

New behavior:
Infrastructure for capturing and reading session output logs including PathManager for log file path management, TeeWriter for capturing stdout/stderr while displaying to terminal, log Reader with ReadAll/ReadLastN/Follow modes, SessionWriters for combined logging, and Logs field added to StorageConfig with default path at ~/.local/share/headjack/logs/<instance-id>/<session-id>.log

Closes: #4
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.

2 participants