winston-slack-logger

1.0.0 • Public • Published

winston-slacker Build Status

Slack integration for Winston 3

Installing

$ npm install winston-slacker

This transport can be used like most standard Winston transports to send messages to a Slack channel.

Options

Standard options are support as well as the following additions:

  • webhook: Your Slack channel's webhook URL
  • channel: The channel to send messages to (with the # like #general)
  • username: The username to use for the message in Slack
  • iconUrl: URL for Slackbot avatar
  • iconImoji: Emoji for Slackbot icon
  • customFormatter: Function used to format the message for Slack
var winston = require('winston');
var WinstonSlacker = require('winston-slacker');
var options = {
  // Set options up
};
winston.add(new WinstonSlacker(options));

You are done configuring winston-slacker. Now it's time to use it!

// Log a message with winston
winston.log({
  level: 'info',
  message: 'User has logged in successfully.'
})
 
// Then, see in Slack:
// [info] User has logged in successfully.

Tests

To run tests run npm install and then npm test from the root directory in your shell.

Package Sidebar

Install

npm i winston-slack-logger

Weekly Downloads

8

Version

1.0.0

License

MIT

Unpacked Size

9.48 kB

Total Files

9

Last publish

Collaborators

  • levibostian