# Logging

Source: https://righteousbot.dev/docs/features/logging/

Send message, member, role, channel, voice, invite, emoji and moderation events to channels of your choice.

[`,log`](/commands/server-tools/log/#log) (also `/log`) sends eight categories of server activity to
channels you pick: `messages`, `members`, `roles`, `channels`, `voice`, `invites`, `emojis` and
`moderation`. It needs **Administrator**.

<Callout type="warn" title="An empty event list means every event">
  Pointing a category at a channel logs **everything** in it, not nothing. Narrow it with
  `,log events` if you don't want that.
</Callout>

## Send a category to a channel [#send-a-category-to-a-channel]

<CommandBlock syntax=",log add <#channel> [categories...]" example=",log add #mod-log members roles" />

[`,log add`](/commands/server-tools/log/#log-add) with no categories routes **all** of them to that channel.
[`,log remove`](/commands/server-tools/log/#log-remove) with no categories stops every category pointed at
it. With categories, it clears only those, and only where they point at that channel.

<CommandBlock syntax=",log list" />

[`,log list`](/commands/server-tools/log/#log-list) shows each category's channel, how many events are on,
and whether webhook delivery is on. [`,log reset`](/commands/server-tools/log/#log-reset) clears every
category, channel and ignore entry at once, with no per-category form.

## Pick which events post [#pick-which-events-post]

<CommandBlock syntax=",log events <category> [event] [on|off]" example=",log events voice voicejoin off" />

[`,log events`](/commands/server-tools/log/#log-events) with just a category lists its events and which are
on. `voice` is the noisiest: turn off `voicejoin` and `voiceleave` and keep `voicemove`, `voicemute`,
`voicedeafen` and `voicestream`.

## Ignore a channel, role or member [#ignore-a-channel-role-or-member]

<CommandBlock syntax=",log ignore <member|channel|role>" example=",log ignore #staff-chat" />

[`,log ignore`](/commands/server-tools/log/#log-ignore) applies to **every** category at once, not just
one. `,log ignore list` shows the list and `,log ignore remove <target>` takes an entry off.

## Post through a webhook [#post-through-a-webhook]

<CommandBlock syntax=",log webhook <#channel|default> <on|off|name|avatar> [value]" example=",log webhook #mod-log on" />

[`,log webhook`](/commands/server-tools/log/#log-webhook) `on` is free. Setting a custom **name or avatar**
needs **Server Premium**. `default` sets a server-wide fallback identity. A category's own override wins,
then the default, then the webhook's own. Name and avatar are set separately.

## Restore a deleted role or channel [#restore-a-deleted-role-or-channel]

Every logged role or channel deletion has a **Restore** button that works **once** per deletion. It rebuilds
the object from its recorded settings (name, color, permissions, topic, overwrites). It does **not** bring
back who held the role or the channel's messages.

It checks permissions and role hierarchy (a role against its position when deleted). If the click fails, the
button stays usable. If two admins click together, one is told someone beat them to it.

**Copy IDs** on the same entry sends you the deleted object's ID and the moderator's, ready to paste.

<DiscordEmbed
  caption="A role deletion in your log channel. Channel deletions use the same layout with Type and Category fields, and role or channel edits swap Restore for Show Changes."
  color="#dc141a"
  author="sam"
  description="&#x22;**Role deleted:** `Event Host` by @Sam&#x22;"
  fields="[
  { name: &#x22;Color&#x22;, value: &#x22;#9b59b6&#x22;, inline: true },
  { name: &#x22;Hoisted&#x22;, value: &#x22;Yes&#x22;, inline: true },
  { name: &#x22;Mentionable&#x22;, value: &#x22;No&#x22;, inline: true },
  { name: &#x22;IDs&#x22;, value: &#x22;Executor: `123456789012345678`&#x22; },
]"
  footer="ID: 876543210987654321"
  rows="[[{ label: &#x22;Restore&#x22;, style: &#x22;success&#x22; }, { label: &#x22;Copy IDs&#x22; }]]"
/>

## Open the config panel [#open-the-config-panel]

<CommandBlock syntax=",log panel" />

[`,log panel`](/commands/server-tools/log/#log-panel) has a page per category, an Overview and a Webhooks page.

## Common issues [#common-issues]

**A category I only pointed at a channel logs everything.** That's the default. Use `,log events` to narrow it.

**My webhook name or avatar never shows.** Customizing them needs Server Premium. The `on` toggle doesn't.

**I deleted the log channel and nothing posts, but `,log list` still shows the category.** Deleting the
channel clears the routing only. Your event and webhook settings stay, so run `,log add` with a new channel.

**Restore says someone already used it.** Each deletion can be restored once. Check the log line for who did it.

Still stuck? See [common issues](/docs/common-issues/).
