/** * Stream Console Logs from Simulator * * Real-time log streaming with filtering, severity classification, deduplication, and statistics. * * @param args Tool arguments * @returns Log streaming result with per-severity counts, top errors/warnings, and tail sample */ export declare function streamLogsTool(args: any): Promise<{ content: { type: "text"; text: string; }[]; isError: boolean; }>; export declare const SIMCTL_STREAM_LOGS_DOCS = "\n# simctl-stream-logs\n\nStream real-time console logs from iOS simulator with filtering, severity classification,\ndeduplication, and statistics summary.\n\n## What it does\n\nStreams console logs from a simulator in real-time, with support for filtering by process\nor custom predicates. Captures logs for a specified duration and returns:\n- Structured log entries with timestamps, process names, and per-line severity\n- Statistics summary (totalLines, errors, warnings, info, debug)\n- Top errors and warnings (deduplicated, capped at 15 each)\n- Sample tail of raw log output\n\n## Parameters\n\n- **udid** (string, required): Simulator UDID (from simctl-list)\n- **bundleId** (string, optional): Filter logs to specific app bundle ID\n- **predicate** (string, optional): Custom NSPredicate for log filtering\n- **duration** (number, optional): Capture duration in seconds (default: 10)\n- **capture** (boolean, optional): Whether to capture logs (default: true)\n- **severity** (string | string[], optional): Comma-separated or array of severity levels to include\n in the returned items. Allowed values: `error`, `warning`, `info`, `debug`. Default: all four.\n Statistics always count all severities regardless of this filter.\n\n## Severity Classification\n\nEach log line is classified by case-insensitive pattern matching:\n\n| Severity | Patterns |\n|----------|----------|\n| error | \\berror\\b, \\bfault\\b, \\bfailed\\b, \\bexception\\b, \\bcrash\\b, \u274C |\n| warning | \\bwarning\\b, \\bwarn\\b, \\bdeprecated\\b, \u26A0\uFE0F |\n| info | \\binfo\\b, \\bnotice\\b, \u2139\uFE0F |\n| debug | anything that does not match the above |\n\n## Deduplication\n\nError and warning lines are deduplicated before appearing in `topErrors` / `topWarnings`.\nThe deduplication signature is computed by stripping timestamps (`YYYY-MM-DD HH:MM:SS`)\nand process IDs (`[1234]`) then collapsing whitespace. Duplicate occurrences are collapsed\ninto a single entry with a `count` field.\n\n## Returns\n\nJSON response with:\n- **logs**: Filtered log entries (severity-filtered, first 100 items)\n - count, predicate, bundleId, duration, severityFilter, items[]\n- **statistics**: `{ totalLines, errors, warnings, info, debug }`\n- **topErrors**: Deduplicated error lines, up to 15, each with `message` and `count`\n- **topWarnings**: Deduplicated warning lines, up to 15, each with `message` and `count`\n- **sampleTail**: Last 20 raw log lines\n- **guidance**: Human-readable summary strings\n\n## Examples\n\n### Stream all logs for 10 seconds\n```typescript\nawait streamLogsTool({ udid: 'device-123' })\n```\n\n### Stream errors and warnings only for specific app\n```typescript\nawait streamLogsTool({\n udid: 'device-123',\n bundleId: 'com.example.MyApp',\n duration: 30,\n severity: 'error,warning',\n})\n```\n\n### Stream with custom predicate\n```typescript\nawait streamLogsTool({\n udid: 'device-123',\n predicate: 'eventMessage CONTAINS \"Error\" OR eventMessage CONTAINS \"Warning\"',\n duration: 20,\n})\n```\n\n## Predicate Syntax\n\nSupports NSPredicate syntax for filtering:\n- **Process filtering**: `process == \"MyApp\"`\n- **Content filtering**: `eventMessage CONTAINS \"keyword\"`\n- **Severity filtering**: `messageType == \"Error\"`\n- **Combined filters**: `process == \"MyApp\" AND eventMessage CONTAINS \"network\"`\n\nCommon predicates:\n- `process == \"com.example.MyApp\"` - Filter by bundle ID\n- `eventMessage CONTAINS \"Error\"` - Show only errors\n- `subsystem == \"com.example.networking\"` - Filter by subsystem\n- `messageType IN {\"Error\", \"Fault\"}` - Show errors and faults\n\n## Common Use Cases\n\n1. **App debugging**: Stream logs for specific app during testing\n2. **Error monitoring**: Filter for errors and warnings via severity param\n3. **Network debugging**: Monitor network-related log messages\n4. **Performance tracking**: Capture logs during performance tests\n5. **Integration testing**: Verify expected log output during test runs\n\n## Important Notes\n\n- **Timeout buffer**: Command timeout is duration + 5 seconds for safety\n- **Buffer size**: 10MB buffer for log capture to prevent overflow\n- **First 100 logs**: Returns first 100 severity-filtered log entries to avoid token overflow\n- **Statistics always complete**: Counts cover all lines regardless of severity filter\n- **Dedup on errors/warnings**: topErrors and topWarnings collapse repeated messages\n\n## Error Handling\n\n- **Missing udid**: Error if udid is not provided\n- **Simulator not found**: Validates simulator exists\n- **Command timeout**: Times out if duration exceeds limit\n- **Buffer overflow**: May lose logs if output exceeds 10MB buffer\n\n## Duration Guidelines\n\n- **Quick check**: 5-10 seconds for basic log verification\n- **Feature testing**: 15-30 seconds for testing specific features\n- **Integration tests**: 30-60 seconds for full test scenarios\n- **Debug sessions**: 60+ seconds for deep debugging sessions\n"; //# sourceMappingURL=stream-logs.d.ts.map