Skip to content

feat(ios): structured app logs that follow relaunches - #6179

Draft
rigor789 wants to merge 1 commit into
feat/ios-shared-derived-datafrom
feat/ios-structured-logs
Draft

rigor789 wants to merge 1 commit into
feat/ios-shared-derived-datafrom
feat/ios-structured-logs

Conversation

@rigor789

@rigor789 rigor789 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Draft until ios-device-lib is released. CI can't compile this against 0.9.6, because the types for the new stream are missing. After NativeScript/ios-device-lib#88 ships, bump the dependency here and mark this ready.

What is the current behavior?

App logs on devices come from syslog_relay, filtered with fragile regexes. Kernel noise such as wlan0: lines gets through, non-ASCII text is escaped, and there is no way to choose how much native output to show. Long messages are truncated by os_log with <…>.

What is the new behavior?

  • Devices stream os_trace_relay and simulators use log stream --style ndjson, both selected by executable name, so logs survive closing and reopening the app with no pid tracking.
  • --log sets the scope:
    • default: JS output
    • debug: the whole app process without debug entries, like Xcode
    • trace / all: everything
  • Debug builds write logChunkMarkers to the app's package.json, and the CLI stitches split messages back together per process and thread. Webpack doesn't touch that file and the key only re-signs, so build caching isn't affected.
  • Devices fall back to the syslog relay, with markers removed, if the stream isn't available.
  • The unused lib/common/mobile/ios/ios-log-filter.ts is deleted.

print() and stderr capture follow in #6181.

Testing

Demo app, 11 messages (up to 100 KB, emoji, 800 lines, console.error, objects) compared exactly against the expected text, on both launches of each run. The full four-PR stack with the runtime PRs:

Setup Simulator (iOS 26.2) iPad (iPadOS 26.7)
Default 11/11 11/11
--log debug and --log trace, before stacking 11/11 11/11
This CLI with stock runtime 9.1.0, before stacking no markers, long messages still truncated as today not run
  • Release prepare leaves the key out and debug prepare includes it.
  • Trailing whitespace at the end of a message is trimmed, as it already was.
  • The syslog fallback has only been tested on captured logs, not in a live app.
  • --log trace is large: about 11,000–13,000 extra lines per run of the demo app.
  • See feat(console): split long messages for os_log and report errors as errors ios#530 for the known limit on chunk loss under extreme bursts.

Part of a stack

Base: #6178. Needs NativeScript/ios-device-lib#88 released, and NativeScript/ios#530 for stitching.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Devices stream com.apple.os_trace_relay and simulators use log stream, both selected by executable name, so logs survive closing and reopening the app. --log picks the scope: JS output by default, the app's native logs without debug entries with debug, everything with trace or all. Without a new enough ios-device-lib, devices fall back to the syslog relay.

Debug builds ask the runtime for chunk markers through logChunkMarkers in the app's package.json, and the CLI stitches split messages back together per process and thread.
@rigor789
rigor789 force-pushed the feat/ios-structured-logs branch from bfef406 to 8783785 Compare October 30, 2026 22:15

This branch has not been deployed

No deployments
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