DeviceLog
The device log since the attachment opened (Device.logs): every logcat line of the main, system and crash buffers, with the actions Tap ran and the markers a test wrote in between, in the order they happened.
The server captures it from the moment the device is attached, unless the attachment turned that off (DeviceOptions.captureLogs; every call here then fails with ServerException, FailureReason.DAEMON_PRECONDITION). This reads the log while the device is attached; the server also keeps it after detach and restart, read with TapClient.history. Secrets are replaced by <redacted> before the server stores a line and again on read: see redact.
device.logs.mark("checkout")
pay.tap()
val errors = device.logs.read(LogStart.Marker("checkout"), LogFilter(packages = listOf("com.shop"), minPriority = LogPriority.WARN))
check(errors.lines.isEmpty()) { errors.text }Functions
The entries from start and then every new one as it is logged. The flow is cold: each collection is one stream, which ends when the collector is cancelled or the device is detached. Collect it in its own coroutine, or to wait for a line:
Writes a named marker into the log, at the time the server gets the call, and returns its cursor. Read from it with LogStart.Marker; a later marker with the same name replaces it as the starting point. name is 1 to 200 characters on one line.
Adds regular expressions (Java syntax) whose matches are replaced by <redacted> in everything read from now on, lines already captured included: by read and follow, Device.deviceLogs and the failure artifacts. A match is replaced whole; a pattern with a capturing group has only its first group replaced (session=(\w+) keeps session=).