# Slack Appender

Sends log events to a slack (opens new window) channel.

npm install --save @tsed/logger-slack
1

# Configuration

  • type - slack
  • options.token - string - your Slack API token (see the (slack web api docs)[https://slack.dev/node-slack-sdk/web-api])
  • options.channel_id - string - the channel to send log messages
  • options.icon_url - string (optional) - the icon to use for the message
  • options.username - string - the username to display with the message

# Example

import {Logger} from "@tsed/logger";
import "@tsed/logger-slack";

const logger = new Logger("loggerName");

logger.appenders.set("stdout", {
  type: "slack",
  level: ["error"],
  options: {
    token: "xoxb-xxxx-xxxx-xxxx",
    channel_id: "prod-alerts",
    username: "our_application"
  }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Last Updated: 10/26/2023, 6:30:07 AM

Other topics