Logs · DeviceLogs
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Read a log: the current WebView's console, or the device's own log (logcat on Android, the unified log on an iOS simulator, and on a real iPhone what the session has captured since it started — a phone keeps no history). These call app_logs.
Logs
func (d *Device) Logs(ctx context.Context, level string) ([]ConsoleEntry, error)
Logs returns what the current WebView has written to its console since the last call, including uncaught errors and unhandled promise rejections. Pass "" for every level.
Each read drains what it returns, so it reports what happened since the last call — which is what makes "nothing was logged during this step" assertable. Capture starts when the context is entered, so a page's initial load is already over by then.
DeviceLogs
func (d *Device) DeviceLogs(ctx context.Context, app, level string, lines int) (entries []DeviceLogEntry, skipped int, err error)
DeviceLogs reads the device's own log — logcat on Android, the unified log on an iOS simulator — since the last read. The first read returns the most recent lines. An empty app reads the whole device; an empty level keeps every level; lines of zero takes the tool's default.
skipped counts lines newer than the last read that the limit dropped. They will not come back, so a caller waiting for one line should narrow by app or level rather than read again.
Examples
Read one app's errors from the device log
// 0 lines takes the tool's default.
entries, skipped, err := dev.DeviceLogs(ctx, "com.example.shop", "error", 0)
if err != nil {
return err
}
for _, e := range entries {
fmt.Println(e.Time, e.Tag, e.Message)
}
fmt.Println(skipped, "lines skipped")