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

# Log Handler

> This is a log handler for your bot. It will collect all the logs from your bot and display them in the dashboard's admin page.

## Dashboard Setup

Place this in your admin config which is located in the theme config and change the key to your own **SECURE** string.

```js theme={null}
theme: SoftUI({
  admin: {
    logs: {
      enabled: Boolean,
      key: String,
    },
  },
});
```

### Example Usage

```js theme={null}
theme: SoftUI({
  admin: {
    logs: {
      enabled: true,
      key: "place your key here!",
    },
  },
});
```

## Image

<Frame>
  <img src="https://mintcdn.com/assistantscenter/e0fzjuWUPc5-sSJC/images/content/logs.jpg?fit=max&auto=format&n=e0fzjuWUPc5-sSJC&q=85&s=f701368dba3885dbc9be2b12adf507cc" width="2053" height="624" data-path="images/content/logs.jpg" />
</Frame>

## Bot Setup

Install the NPM package in **Bot**

<CodeGroup>
  ```bash npm theme={null}
  npm install @dbd-soft-ui/logs
  ```

  ```bash yarn theme={null}
  yarn add @dbd-soft-ui/logs
  ```

  ```bash pnpm theme={null}
  pnpm add @dbd-soft-ui/logs
  ```

  ```bash bun theme={null}
  bun add @dbd-soft-ui/logs
  ```
</CodeGroup>

Almost done! Place this code into your ready event on the bot.

```js theme={null}
const DLU = require("@dbd-soft-ui/logs");

client.on("ready", () => {
  DLU.register(client, {
    dashboard_url: String,
    key: String,
  });
});

process.on("unhandledRejection", (reason, p) => {
  DLU.send(client, {
    title: String,
    description: reason,
  });
});
```

It should look like this, except with your details:

```js theme={null}
const DLU = require("@dbd-soft-ui/logs");

client.on("ready", () => {
  DLU.register(client, {
    dashboard_url: "https://softui.assistantscenter.com",
    key: "YOURKEYHERE",
  });
});

process.on("unhandledRejection", (reason, p) => {
  DLU.send(client, {
    title: "Unhandled Rejection",
    description: reason,
  });
});
```

And we are done! Now just restart your dashboard and bot then the logs collection will begin.

## Props

<ParamField path="dashboard_url" type="string" required>
  A String with the url to your dashboard
</ParamField>

<ParamField path="key" type="string" required>
  A String with the secret key from your dashboard
</ParamField>
