fix(logger): restore wallclock timestamp on console output (macOS)#49
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
#48 split formatting into `formatLine` (no timestamp, console) and `formatEntry` (timestamp, file). On Linux this was fine — the journal stamps every line — but on macOS launchd writes raw bytes to `logs/maestro-relay.log`, so `maestro-relay-ctl logs` showed untimestamped debug/info/warn lines. Route all console emitters through `formatEntry(...).trimEnd()`. Linux gets a (redundant) inner ISO timestamp alongside the journal's local-time prefix; macOS gets parity with pre-#48 behavior. `logs/errors.log` unchanged.
Left over after the macOS timestamp fix routed all console output through formatEntry; formatLine had no remaining callers. Dropping it removes dead code and keeps logger.ts focused on a single line format. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
379d87c to
645ae83
Compare
chr1syy
added a commit
that referenced
this pull request
Jun 7, 2026
Bundles four merged PRs since v0.2.0: - #46 OS-agnostic auto-run + attachments tests (Windows CI fix) - #47 typed bridge errors + `Retry-After` header on 429 - #48 leveled logger consolidation + `LOG_LEVEL` env var - #49 wallclock ISO timestamps on console output (macOS launchd gap) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
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
Follow-up to #48 — stacked on top of
chore/logger-consolidation. Routes all console emitters throughformatEntry(...).trimEnd()so log lines carry a wallclock ISO timestamp. Closes the macOS-only gap wheremaestro-relay-ctl logs(which tails the raw launchd output file) had no timestamps on debug/info/warn lines.Why
templates/sh.maestro.relay.plistredirects stdout/stderr to a flatlogs/maestro-relay.logfile. launchd does not stamp lines. Before this PR, a macOS operator saw[INFO] [api/startup] listening on http://...with no time context.On Linux,
StandardOutput=journalintemplates/maestro-relay.servicemeansjournalctlalready adds a local-time prefix. The inner ISO timestamp this PR adds is mildly redundant on Linux but accepted as the simpler design — operators can filter on either timestamp. The alternative (TTY/env-gated formatting) is more code for marginal benefit.Behavior change
journalctlJun 07 10:53:21 host relay[...]: [INFO] [ctx] msgJun 07 10:53:21 host relay[...]: [2026-06-07T08:53:21.123Z] INFO [ctx] msgmaestro-relay-ctl logs[INFO] [ctx] msg[2026-06-07T08:53:21.123Z] INFO [ctx] msglogs/errors.logImplementation
src/core/logger.ts:emit()helper and theerror()console branch now useformatEntry(level, ctx, detail).trimEnd()(the file-append path still uses the un-trimmedformatEntry(...)so the trailing newline lands inerrors.log).formatLineis left in place for now in case a future PR wants TTY-gated formatting; it builds cleanly withoutnoUnusedLocalscomplaint.src/__tests__/logger.test.ts: updated the three regex assertions matching\[LEVEL\] \[ctx\] detailto match\[ISO-ts\] LEVEL \[ctx\] detail$instead.Test plan
npm test— 219/219 pass with updated regexnpm run build— clean