> ## Documentation Index
> Fetch the complete documentation index at: https://flowdeck.studio/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# OSLog Integration

> Stream and filter simulator logs in Cursor

FlowDeck provides OSLog integration that streams logs from iOS simulators directly within Cursor through a dedicated log viewer panel.

<Warning>
  OSLog streaming is currently only available for simulators. Physical device logs must be viewed using Console.app.
</Warning>

## Features

* **Real-time Log Streaming** - View simulator logs as they happen during app execution
* **Log Panel** - Dedicated webview panel for viewing and filtering logs
* **Filtered Output** - Automatically filters to show only your app's logs
* **Integration with Debug Sessions** - Logs automatically start streaming when debugging

## Getting Started

<Steps>
  <Step title="Open your project">
    Open your iOS/macOS project in Cursor with FlowDeck
  </Step>

  <Step title="Select a simulator">
    Choose a simulator as your build destination
  </Step>

  <Step title="Start debugging">
    Launch your app with debugging (F5)
  </Step>

  <Step title="View logs">
    Logs automatically appear in the FlowDeck Logs panel
  </Step>
</Steps>

## How It Works

When you start a debug session on a simulator, FlowDeck:

1. Detects your app name and simulator ID
2. Runs `xcrun simctl spawn` with `log stream` to capture logs
3. Filters logs using predicates like `processImagePath CONTAINS "YourApp"`
4. Displays filtered logs in the FlowDeck Logs panel

## Using OSLog in Your Code

FlowDeck captures logs from Apple's unified logging system:

```swift theme={null}
import os

// Create a logger
let logger = Logger(subsystem: "com.yourapp.main", category: "UI")

// Log at different levels
logger.debug("Debug: View will appear")
logger.info("Info: User tapped button")
logger.error("Error: Failed to load data")
```

## Physical Device Logging

When debugging on physical devices, FlowDeck cannot stream logs directly due to Apple's security restrictions.

<Note>
  For physical devices, FlowDeck provides a button to open Console.app where you can manually configure filters to view your device logs.
</Note>

### Using Console.app for Device Logs

When debugging on a device:

1. FlowDeck will show a notification with an option to open Console.app
2. In Console.app, select your device from the sidebar
3. Use the search field to filter by your app name
4. Add predicates like `processImagePath CONTAINS "YourApp"` for better filtering

## Limitations

* **Simulator Only** - Real-time log streaming only works with simulators
* **macOS Requirement** - Uses macOS-specific tools (`xcrun simctl`)
* **Debug Sessions** - Log streaming is tied to debug sessions
* **No Export** - The current implementation doesn't support log export

## Troubleshooting

### No Logs Appearing

* Ensure you're using a simulator, not a physical device
* Check that your app is using `os.log` or `Logger` APIs
* Verify the debug session started successfully

### Too Many Logs

* FlowDeck automatically filters to your app's process
* Avoid logging at Debug level in production code

### Device Logs Not Working

* This is expected - use Console.app for physical devices
* FlowDeck will show a notification with a button to open Console.app
