0.3.4 • Published 8 months ago

@aaaahoang123/winston-slack v0.3.4

Weekly downloads
-
License
-
Repository
github
Last release
8 months ago

Based on wja-no/winston-slack. Rewritten in TypeScript.


Winston Transport for Slack chat integration.

npm install --save @aaaahoang123/winston-slack

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
  • format: use require('logform').Format as original winston
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, label, prettyPrint } = format;

{
    format: combine(
           label({ label: 'right meow!' }),
           timestamp(),
           prettyPrint()
   )
}

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('@aaaahoang123/winston-slack');

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

8 months ago

0.3.3

8 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago