TraceRN.init
Initialize the SDK
Call once as early as possible (e.g. index.js / root layout):
typescript
import { TraceRN } from "tracern-sdk";
TraceRN.init({
apiKey: "trn_live_xxxxxxxx", // required — from Project → Settings
environment: "production", // default "production"
release: "1.2.0", // match source maps + release health
enableAutoErrorCapture: true, // default true
enableConsoleCapture: false, // default false
enableAutoBreadcrumbs: true, // default true
enableNetworkBreadcrumbs: true, // fetch breadcrumbs when auto on
enableAppStateBreadcrumbs: true, // AppState breadcrumbs when auto on
enableSessionHeartbeat: true, // session ping for crash-free %
slowNetworkThresholdMs: undefined, // e.g. 3000 → warn on slow fetch
maxBreadcrumbs: 50, // default 50, max 100
sampleRate: 1, // info/warn only; errors always send
userId: "user_42", // optional; or call setUser later
tags: { platform: "ios" },
apiBaseUrl: undefined, // default https://tracern-api.devlys.com
});| Option | Default | Notes |
|---|---|---|
apiKey | — | Required |
environment | "production" | e.g. staging / dev |
release | — | Build / app version string |
enableAutoErrorCapture | true | JS exceptions + rejections |
enableConsoleCapture | false | Forwards console.* |
enableAutoBreadcrumbs | true | Logs + optional network/state |
enableNetworkBreadcrumbs | true* | *when auto breadcrumbs on |
enableAppStateBreadcrumbs | true* | *when auto breadcrumbs on |
enableSessionHeartbeat | true | Info session.start on init |
slowNetworkThresholdMs | — | Warn-level slow fetch event |
maxBreadcrumbs | 50 | Cap 100 |
sampleRate | 1 | Fraction of info/warn |
userId | — | Also setUser() |
tags | — | String map on every event |
apiBaseUrl | TraceRN API | Self-host / local |
Optional peers (feature-detected):
bash
npm install react-native-device-info @react-native-async-storage/async-storageLast updated · TraceRN docs