Skip to content
TraceItX Docs
Documentation

Console & network

The last few seconds of console output are captured automatically. Network capture is opt-in, one URLSession at a time.

Updated

Console output is captured from start() onwards. Network capture is off until you ask for it, and you ask per session, not with a flag:

let session = URLSession(configuration: TraceItX.shared.networkCaptureConfiguration())

networkCaptureConfiguration(base:) copies a URLSessionConfiguration (.default unless you pass one) and puts the SDK’s URLProtocol in front. Only sessions built from it are captured. URLSession.shared is never touched, and the SDK never swizzles URLSession globally, so it does not fight other SDKs that do.

Set CaptureConfig(network: true) as well — it captures nothing by itself, but body capture requires it.

Both streams are rolling buffers — you get the entries leading up to the report, not the whole session.

What is captured

ConsoleWhatever your app writes to stderrNSLog, and os.Logger in Debug builds. print() goes to stdout and is not captured. Level is not recorded; console crumbs are always info.
NetworkRequests on captured sessions, as metadata: method, URL, status, duration, and allowlisted headers.

Console and network each have their own fixed-size buffer. capture.ringBufferCapacity exists in the config and defaults to 250, but it is not read by the SDK today. Setting it changes nothing; it is documented here so you do not spend an afternoon wondering why.

Entries are also trimmed against a byte budget, so a chatty app sheds old entries rather than inflating the report.

Bodies are separate and off by default. See Network bodies.

What is not captured

Anything not on a session you built from networkCaptureConfiguration(): URLSession.shared, sessions a library creates with its own configuration, and stacks that bypass URLSession entirely. Libraries that let you supply a URLSessionConfiguration — Alamofire’s Session among them — can be captured by passing the SDK’s configuration in. Background sessions do not run custom URLProtocols, so their requests are never captured.

If a request is missing from a report, which session it ran on is the first thing to check.

How they reach the envelope

Both land as breadcrumbs, with kind: "console" and kind: "network", on the shared clock. The envelope also carries payload.logs and payload.network arrays, but those are deprecated — still populated during the deprecation window so older receivers keep working.

Read payload.breadcrumbs and filter by kind. It is the only way to see console and network interleaved with screens and taps on one timeline.

Redaction

Both streams pass through the redaction engine before they are buffered, not before they are sent. A token in a query string never reaches the buffer, so it cannot be recovered from a report even by us.