pull
Pull a snapshot of the device's logs: wait for the host's logs to replicate in, then return everything captured so far in the device's order, with no duplicates.
Waits until the host is connected and its first-contact full-state has actually merged — not merely until a peer appears — so it never returns the still-empty initial state over an asynchronous (real-network) link. Bounded by LogTapConfig.pullTimeout: a pull that does not converge in time throws kotlinx.coroutines.TimeoutCancellationException rather than returning a partial result. The result is a point-in-time snapshot; call again (or use tail) to observe records captured later.
Samples
// The device's captured-log buffer — the same one installLogCapture fills.
val exporter = WarpLogRecordExporter(
replica = ReplicaId("device-uuid-abc123"),
store = InMemoryDurableStore(),
)
// The fabric the two peers meet over. An in-memory/loopback Loom is the
// simulator-and-CI case; swap it for a LAN (mDNS + WebSocket) or peer-to-peer
// (Multipeer) Loom to reach a real phone — the tap code below is unchanged.
val loom = InMemoryLoom()
// On the device: turn the opt-in tap on. It does nothing until called and is
// loopback-bound by default. Hold the host; close it to stop offering logs.
val host = installLogTap(loom, exporter, scope)
// In the test / CI harness: join the same session and pull the backlog —
// every line the device captured, in the device's order, with no duplicates.
val client = LogTapClient(loom.join(InMemoryTag("puller")), scope)
val logs: List<LogRecord> = client.pull()
// Release both replicators when finished.
client.close()
host.close()
return logsContent copied to clipboard