@bisontry/node
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Bisontry Node

Bisontry Node is a library that sends notifications to Slack when an error occurs.

🚀 Installation

Install the package using npm:

npm install @bisontry/node

📝 Usage

First, import the library and initialize it with your user configuration. This includes your Slack webhook URL for sending notifications.

import { bisontryInit, KlaytnNetwork, NodeEnv, OraklServiceName } from "@bisontry/node";

const userConfig = {
  MESSENGER_ENDPOINT: "" // Replace with bisontry messenger url.
  nodeEnv: NodeEnv.local // Change this according to your environment.
  network: KlaytnNetwork.baobab, // Change this according to your network.
  serviceName: OraklServiceName.test // Change this according to the service you are using.
};

const { BISONTRYLOGGER, bisontryHookConsoleError } = bisontryInit(userConfig);

Next, connect the console error hook:

bisontryHookConsoleError(BISONTRYLOGGER);
try {
  throw new Error('This is a test error');
} catch (error) {
  BISONTRYLOGGER.error({ name: 'main', error });
}

When you call the BISONTRYLOGGER.error method with an object containing additional details (like 'name'), it provides more precise information about the error. This information will be sent to Slack.

⚙️ Configuration

The userConfig object can define the following properties:

  • MESSENGER_ENDPOINT: The Bisontry Messenger URL.

If additional configurations are needed, modify the userConfig object passed to the bisontryInit function.

Readme

Keywords

none

Package Sidebar

Install

npm i @bisontry/node

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

198 kB

Total Files

49

Last publish

Collaborators

  • jaycetop