Skip to content

fix(logs): emit valid JSON and remove debug output - #1189

Open
pham-canh wants to merge 1 commit into
google:masterfrom
pham-canh:fix/tail-logs-json-output
Open

pham-canh wants to merge 1 commit into
google:masterfrom
pham-canh:fix/tail-logs-json-output

Conversation

@pham-canh

@pham-canh pham-canh commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

tail-logs has two output bugs:

  1. A debug line is printed before fetching logs:
PAST mock-gcp-project

This was accidentally introduced in 8952aff ("feat: Display logs in local time") and is written directly to stdout for every invocation.

  1. With --json, each log entry is prefixed with severity, timestamp, and function name, so the output is not valid JSON:
INFO 2023-10-27T17:00:00 myFunction {
  "timestamp": ...
}

This change:

  • removes the stray debug line;
  • makes --json emit one compact JSON object per log entry (newline-delimited JSON), which is parseable and works with --watch;
  • keeps the existing human-readable output unchanged;
  • updates the JSON test to actually parse the output.

Testing

  • npm test — 236 passing
  • npm run check — Biome and TypeScript compile pass

No README changes are required.

  • npm run test succeeds.
  • npm run lint succeeds.

@pham-canh
pham-canh force-pushed the fix/tail-logs-json-output branch from 16b49e9 to 1106c34 Compare December 4, 2026 11:24
@pham-canh pham-canh changed the title fix(logs): remove stray debug output from tail-logs fix(logs): emit valid JSON and remove debug output Dec 4, 2026
@pham-canh
pham-canh force-pushed the fix/tail-logs-json-output branch from 1106c34 to f979535 Compare December 4, 2026 11:27
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