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

# useSendLog

> Send structured log messages.

<Badge color="yellow">sunpeak API</Badge>

## Overview

Returns a function to send structured log messages to the host for debugging and monitoring.

<Card horizontal title="Wraps sendLog" icon="cube" href="/mcp-apps/app/requests/send-log">
  MCP Apps SDK reference
</Card>

## Import

```tsx theme={null}
import { useSendLog } from 'sunpeak';
```

## Signature

```tsx theme={null}
function useSendLog(): (params: SendLogParams) => void
```

### SendLogParams

<ResponseField name="level" type="LogLevel" required>
  Log level: `'debug' | 'info' | 'warning' | 'error' | 'critical'`
</ResponseField>

<ResponseField name="data" type="unknown" required>
  Log data payload.
</ResponseField>

<ResponseField name="logger" type="string">
  Logger name for categorization.
</ResponseField>

## Returns

<ResponseField name="sendLog" type="(params: SendLogParams) => void">
  Function to send a log message to the host.
</ResponseField>

## Usage

```tsx theme={null}
import { useSendLog } from 'sunpeak';

function MyResource() {
  const sendLog = useSendLog();

  const handleAction = () => {
    sendLog({ level: 'info', data: { action: 'button_clicked' }, logger: 'MyResource' });
  };

  return <button onClick={handleAction}>Click Me</button>;
}
```
