Skip to content

Client logging

Client diagnostic logs go to native logging layers or to an optional app sink. The sink is process-wide on native platforms and Node.js, and worker-wide in a browser. A slow or failed sink must not stop client work. The client keeps a fixed number of records that wait for handoff and reports overflow to the app.

In scope: client diagnostic log delivery, sink lifetime, queue capacity, drop reporting, failure isolation, and client secret redaction.

Out of scope: audit logging, backend telemetry, and message bodies. AUTH-027 owns redaction in backend logs and does not replace LOG-010.

TermMeaning
Sink generationOne installed app sink. Clearing or replacing it ends that generation.
DispatchThe point where the client selects one retained record for its next delivery attempt and captures that generation’s pending drop count. The selected record still awaits handoff.
HandoffThe point at which the host-side generation check admits a callback for a record.
Pending drop countThe number of overflow records not yet cleared by a successful report in that sink generation.

The client sends diagnostic records to its logging layers by default. When an app installs a sink, the client retains records for asynchronous handoff in admission order. Dispatch selects one record for its next delivery attempt and captures its pending drop count. The record still waits for host handoff. One callback can run at a time across sink generations. A record waiting for handoff uses one queue slot; a callback that has started does not. A replacement may discard queued records and the pending drop count. There is no final flush when a sink ends.

IDTitleRequirementWhy
LOG-001Native default loggingWhen no app sink is installed, the client MUST send logs to its native logging layers.Apps must get diagnostics without a callback.
LOG-002Asynchronous sink orderWhen a sink is installed, the client MUST hand retained records to it asynchronously in admission order, with at most one active app log callback across sink generations; LOG-011 defines which records replacement discards.Concurrent callbacks can reorder events and retain a thread per replaced sink.
LOG-003Queue capacityWhile app log records await handoff, the client MUST retain at most 4096 queued records across sink generations, queues, and transport, in addition to the one active callback.A slow app must not cause unbounded retained logs.
LOG-004Nonblocking log emissionWhen recording a log or completing a client operation, the client MUST NOT wait for an app log callback to complete.A slow sink must not block messaging.
LOG-005Overflow drops new recordsWhen a sink generation already has 4096 queued records, the client MUST discard each new record for that sink and increment its pending drop count by one.The app must be able to detect lost diagnostics.
LOG-007Sink replacement boundaryWhen clearing or replacing a sink, the client MUST stop old-generation handoffs before the operation returns, without waiting for a callback already handed off.Waiting can deadlock a sink that replaces itself.
LOG-008Reentrant sink callsWhen a sink callback calls an SDK operation, the client MUST let that operation complete without waiting for the calling callback.A callback must not wait on itself or a held client lock.
LOG-009Sink failure isolationWhen an app sink throws or rejects a record, the client MUST keep messaging and its configured native logging layers operational.Diagnostic code must not stop the client.
LOG-010Client secret redactionWhen emitting a log to an app sink or native logging layer, the client MUST omit authentication credential values, private signing keys, and database encryption keys.An app log destination must not receive secrets used by the client.
LOG-011Replacement discards queued logsWhen clearing or replacing a sink, the client MUST discard that generation’s queued records and pending drop count without a final reporting callback.Sink replacement cannot promise delivery after it stops handoffs.
LOG-012Old callback result isolationWhen a callback from a cleared or replaced generation completes, the client MUST ignore its result for the installed generation’s drop count and queue.A late completion must not erase or add another sink’s diagnostics.
LOG-013Report dispatched dropsWhile a sink generation remains installed, the client MUST include the pending drop count captured at dispatch in each call’s droppedRecords field, clear only that reported count on success, and keep it pending on failure. Drops after dispatch MUST remain pending for a later delivery attempt. LOG-011 and LOG-012 govern a cleared or replaced generation.A failed callback must not erase overflow evidence, and a delayed handoff must not lose later drops.