New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@debugr/slack

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@debugr/slack

Elastic log handler to debugr

latest
npmnpm
Version
3.0.0-rc.7
Version published
Weekly downloads
10
-33.33%
Maintainers
2
Weekly downloads
 
Created
Source

Slack Log Handler for Debugr

This log handler will send each entry with a log level at or above a configured threshold as a message to a configured Slack channel.

Installation

npm install --save @debugr/slack

Usage

import { Logger, LogLevel } from '@debugr/core';
import { SlackHandler } from '@debugr/slack';

const globalContext = {
  applicationName: 'example',
};

const logger = new Logger(globalContext, [
  new SlackHandler({
    threshold: LogLevel.FATAL,
    webhookUrl: 'your slack webhook url',
  }),
]);

logger.fatal('Something failed miserably!');

The SlackHandler constructor accepts a required options object with the following keys as the first argument:

OptionTypeDefaultDescription
webhookUrlstring(required)A Slack webhook URL; see the Slack API docs on how to obtain one.
thresholdLogLevelLogLevel.ERRORThe lowest level of entries which will be posted to the configured channel. Any entries below this level will be ignored.
channelstringThe Slack channel ID the message should be posted to. This only works with legacy Slack webhooks.
usernamestringThe slack username the message should be posted under. This only works with legacy Slack webhooks.
iconUrlstringThe URL of an icon to be used in place of the default icon. This only works with legacy Slack webhooks.
iconEmojistringAn emoji code string to use in place of the default icon. This only works with legacy Slack webhooks.
errorCallback(err: Error) => void(see description)A callback which will be called when sending a message to Slack fails. The default callback will simply log the error into the console.
bodyMapper(entry: LogEntry) => Record<string, any>(see description)A callback mapping the log entry to payload to be sent to the configured webhook URL. At a minimum the payload must include a text key with a string content.

FAQs

Package last updated on 15 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts