Skip to content

Configuration

Everything is configured through one object passed to init().

await CodeScout.instance.init(
freshContextFetcher: () => context,
configuration: CodeScoutConfiguration(
logging: LoggingBehavior(...),
projectCredentials: ProjectCredentials(...),
sync: LogSyncBehavior(...),
redaction: RedactionBehavior(...),
realTime: RealTimeConfig(...),
),
);

CodeScoutConfiguration() on its own is a working local-only setup.

What gets captured.

OptionDefaultDescription
minimumLevelLogLevel.infoLevels below this are dropped entirely.
enabledTags{'*'}Which tagged logs to keep. '*' keeps everything.
allowUntaggedtrueWhether logs with no tags are kept when enabledTags is narrowed.
printToConsolekDebugModeConsole output.
includeCurrentStackTracefalseAttach a stack trace to every log, not just ones you pass one to.
captureDeviceInfotrueRecord device model, OS name and version.
captureAppContexttrueRecord your app’s version and build number.
sessionSampleRate1.0Share of launches recorded at all. See Controlling Volume.

Where to send it. Omit entirely to stay local.

OptionDescription
linkYour server’s base URL. Absolute, and it must end in /.
projectIDThe project UUID from the dashboard.
projectSecretThat project’s secret.

Both credentials travel as headers, X-Project-ID and X-Project-Secret, on every request, and are checked against the server’s project_secrets table.

When to upload.

OptionDefaultDescription
syncInterval5 minutesHow often the worker looks for pending logs.
maxBatchSize100Most logs in one upload.

The worker marks logs as syncing, compresses them in a background isolate, uploads, and deletes them on success, rolling back on failure so nothing is lost.

After five failures in a row it goes quiet for five minutes and then tries again by itself. It pauses, it does not stop, so a server that was down for a minute does not cost you every log until somebody restarts the app.

A 429 or 503 is not counted as a failure at all. The worker reads Retry-After, waits for that long, and resumes, so a server protecting itself can never push the SDK into that pause. The wait is clamped to between one second and 24 hours whatever the header says.

A 413 means the batch was too large for the server to accept. The SDK halves its batch size and the next cycle tries again with a smaller one, halving again if it has to, and growing back once an upload succeeds.

What must never leave the device. Opt-in: see Redaction and Privacy.

OptionDefaultDescription
headers{}Header names to strip.
bodyKeys{}Body and metadata keys to strip, at any depth.
maxBodyBytes32 KBBodies larger than this are truncated. 0 disables.
OptionDefaultDescription
enableLiveStreamingtrueWhether this app may be paired with for live streaming.

Set it to false and the app refuses to join a live session however the request arrives. The Go live control disappears from the in-app panel, and startLiveSession() returns false without attempting a connection, so an app that never wants to be watched cannot be.

With no projectCredentials, CodeScout is a complete on-device logger: console output and the in-app overlay, which holds the last 500 logs of the current launch. Sync and live streaming stay off, silently, with nothing to configure and no errors to ignore.

Nothing is written to SQLite in this mode, and that is deliberate rather than missing. The SQLite table is the uploader’s queue, not a store anything reads back, so with no uploader to drain it every log an app ever wrote would sit on the user’s phone for good.

This is the intended way to start. Add the dashboard when you want one.

Logs are batched and uploaded on syncInterval. When you want them gone now rather than at the next tick, await flush():

await CodeScout.instance.flush();

It completes once the batch has either landed or failed. Everything the scheduled upload does still applies, so calling it while one is already running does not start a second, and nothing is deleted from the device until the server has taken it.

The two moments worth calling it are when the app is about to stop being able to, such as going to the background, and on sign out.