Skip to content

Align log file format with the shared convention and add 30-day retention - #9

Merged
rodchristiansen merged 1 commit into
mainfrom
feature/log-convention
Sep 1, 2026
Merged

Align log file format with the shared convention and add 30-day retention#9
rodchristiansen merged 1 commit into
mainfrom
feature/log-convention

Conversation

@rodchristiansen

Copy link
Copy Markdown
Contributor

Summary

  • Log file lines now follow [yyyy-MM-dd HH:mm:ss] LEVEL message (local time, level padded to five characters, only DEBUG, INFO, WARN, ERROR). Session header and structured section lines are written as INFO lines in the same format; WARNING maps to WARN, SUCCESS becomes INFO. Fractional seconds are dropped.
  • Log retention: at logger initialisation, .log files in /Library/Managed Bootstrap/logs older than 30 days are removed. The sweep is non-recursive and tolerates files it cannot inspect or delete.
  • The CLI no longer writes a startup log to /tmp before the logger exists. It creates the real logs directory up front and reports a creation failure on stderr.
  • The in-app log viewer's line colouring is updated for the new level labels.
  • Console output and unified logging are unchanged.

Testing

  • swift build succeeds with no new warnings.
  • swift test: 25 tests in 5 suites pass, including new tests for the line format, for every line of a freshly initialised log file matching the convention, and for the retention sweep against a temporary directory.
  • Not exercised: a real run against /Library/Managed Bootstrap/logs (requires root).

…tion

Log file lines are now written as "[yyyy-MM-dd HH:mm:ss] LEVEL message" in
local time, with the level padded to five characters and limited to DEBUG,
INFO, WARN and ERROR. Session header and structured section lines are
emitted as INFO lines in the same format; WARNING maps to WARN and SUCCESS
is an INFO line. Fractional seconds are dropped from the timestamp.

At logger initialisation, .log files in the logs directory older than 30
days are removed. The sweep is non-recursive and skips anything it cannot
inspect or delete.

The CLI no longer writes a startup log under /tmp before the logger exists.
It creates the real logs directory up front and reports a failure to do so
on stderr.

The log viewer's line colouring is updated for the new level labels, and
tests cover the line format and the retention sweep against a temporary
directory.
@rodchristiansen
rodchristiansen marked this pull request as ready for review September 1, 2026 23:31
@rodchristiansen
rodchristiansen merged commit 8ff6538 into main Sep 1, 2026
2 checks passed
@rodchristiansen
rodchristiansen deleted the feature/log-convention branch September 1, 2026 23:31
rodchristiansen added a commit that referenced this pull request Sep 2, 2026
…tion (#9)

Log file lines are now written as "[yyyy-MM-dd HH:mm:ss] LEVEL message" in
local time, with the level padded to five characters and limited to DEBUG,
INFO, WARN and ERROR. Session header and structured section lines are
emitted as INFO lines in the same format; WARNING maps to WARN and SUCCESS
is an INFO line. Fractional seconds are dropped from the timestamp.

At logger initialisation, .log files in the logs directory older than 30
days are removed. The sweep is non-recursive and skips anything it cannot
inspect or delete.

The CLI no longer writes a startup log under /tmp before the logger exists.
It creates the real logs directory up front and reports a failure to do so
on stderr.

The log viewer's line colouring is updated for the new level labels, and
tests cover the line format and the retention sweep against a temporary
directory.
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