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

# Client Logs

> Capture and view logs from your frontend applications

Client logs help you understand user behavior and debug issues in production.

## Logging with Beacon

```javascript theme={null}
import { Beacon } from '@kodo-status/beacon';

const beacon = new Beacon({
  key: 'bpk_your_key',
  service: 'my-app'
});

// Log levels
beacon.log('debug', 'Component mounted', { component: 'Header' });
beacon.log('info', 'User clicked checkout');
beacon.log('warn', 'API response slow', { duration: 3500 });
beacon.log('error', 'Payment failed', { reason: 'declined' });
```

## Log Levels

| Level   | Use Case                               |
| ------- | -------------------------------------- |
| `debug` | Development debugging, verbose info    |
| `info`  | Normal operations, user actions        |
| `warn`  | Potential issues, degraded performance |
| `error` | Failures that need attention           |

## Structured Logging

Include structured data for better searching:

```javascript theme={null}
beacon.log('info', 'Order placed', {
  orderId: 'ord_123',
  total: 99.99,
  items: 3,
  paymentMethod: 'card'
});
```

## User Context

Logs automatically include user context if set:

```javascript theme={null}
beacon.setUser({
  id: 'user_123',
  email: 'user@example.com'
});

// All logs now include this user info
beacon.log('info', 'Settings updated');
```

## Viewing Logs

View logs in **Dashboard > Settings > Beacon > Logs**:

* Filter by level, service, time range
* Search log messages and data
* Group by user or session
* Export for analysis

## Log Retention

| Plan    | Retention |
| ------- | --------- |
| Starter | 7 days    |
| Pro     | 30 days   |
| Team    | 90 days   |

## Best Practices

<AccordionGroup>
  <Accordion title="Log meaningful events">
    Focus on events that help debugging: user actions, API calls, state changes.
  </Accordion>

  <Accordion title="Include context">
    Add relevant data like IDs, counts, and durations.
  </Accordion>

  <Accordion title="Use appropriate levels">
    Reserve `error` for actual failures, use `warn` for issues that don't block users.
  </Accordion>

  <Accordion title="Avoid sensitive data">
    Never log passwords, tokens, or PII.
  </Accordion>
</AccordionGroup>
