Align log file format with the shared convention and add 30-day retention - #9
Merged
Merged
Conversation
…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
marked this pull request as ready for review
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[yyyy-MM-dd HH:mm:ss] LEVEL message(local time, level padded to five characters, onlyDEBUG,INFO,WARN,ERROR). Session header and structured section lines are written asINFOlines in the same format;WARNINGmaps toWARN,SUCCESSbecomesINFO. Fractional seconds are dropped..logfiles in/Library/Managed Bootstrap/logsolder than 30 days are removed. The sweep is non-recursive and tolerates files it cannot inspect or delete./tmpbefore the logger exists. It creates the real logs directory up front and reports a creation failure on stderr.Testing
swift buildsucceeds 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./Library/Managed Bootstrap/logs(requires root).