JSPM

winston-slack-transport

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 382
  • Score
    100M100P100Q96966F

Package Exports

  • winston-slack-transport

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (winston-slack-transport) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Winston Transport for Slack chat integration.

npm install --save winston-slack-transport

Basic transport that works just like all other winston transports. Sends logged messages to a specified Slack chat channel.

Configuration options:

  • webhook_url: required The webhook URL, something like https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYY/ZZZZZZZZZZZZZZZZZZZZZZZZ
  • level: If specified, this logger will only log messages at the specified level of importance and more important messages
  • custom_formatter: a function (level, msg, meta) which returns a Slack payload object

Additionally, you can specify any Slack message parameters (such as username and channel), and it will be applied as a fallback if the given argument is not specified per message.


var winston = require('winston');
var Slack = require('winston-slack-transport');

winston.add(Slack, {
    webhook_url: "https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYY/ZZZZZZZZZZZZZZZZZZZZZZZZ",
    channel: "#test-channel",
    username: "ErrorBot",
    level: 'error',
    handleExceptions: true
});