npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bugs-connector

v1.0.5

Published

A connector to log system events to a proprietary Bugs server for centralized monitoring.

Downloads

61

Readme

Bugs Connector

bugs-connector is a package designed to log system events to Slack by providing an easy connector to a proprietary ViaMedia Bugs server. This allows you to track and monitor logs effectively.

Features

  • Categorized log types: bad, warn, good, and info.
  • Flexible logging with optional per-log channel specification.
  • Configurable with environment variables for easy integration across services.

Installation

To install bugs-connector in your project:

npm install bugs-connector

Usage

Initialization

Before you can start logging messages, you need to initialize the Bugs system with the URL of your proprietary Bugs server. You can also set an optional default channel for logs.

import bugs from 'bugs-connector';

bugs.init('https://your-bugs-server-url.com', 'default-channel');

Alternatively, you can use environment variables to configure the URL and default channel:

  • BUGS_HOST_URL: The URL of the Bugs server.
  • BUGS_DEFAULT_CHANNEL_ID: The default Slack channel ID for logging.

These can be configured either by

  • using a .env file:
    BUGS_HOST_URL=https://your-bugs-server-url.com
    BUGS_DEFAULT_CHANNEL_ID=0A1B2C3D;
  • or defining them in your project:
    process.env.BUGS_HOST_URL = 'https://your-bugs-server-url.com';
    process.env.BUGS_DEFAULT_CHANNEL_ID = '0A1B2C3D';

Logging Messages

Once initialized, you can start logging messages using the following methods:

  • bugs.bad(message, channel): Logs a "bad" (error) message.
  • bugs.warn(message, channel): Logs a warning message.
  • bugs.info(message, channel): Logs an informational message.
  • bugs.good(message, channel): Logs a "good" (success) message.

If you don't provide a channel, the default channel (if set) will be used.

// Log a "bad" error message to the default channel
await bugs.bad('Database connection failed');

// Log a "good" message to a specific channel
await bugs.good('Server is running smoothly', 'status-updates');

// Log an informational message
await bugs.info('User login successful');

Error Handling

If no channel or URL is provided during initialization or via environment variables, the system will log a warning to the console.

[bugs://warn] No channel provided! (Use `bugs.init` to set up the default channel, or set process.env.BUGS_DEFAULT_CHANNEL_ID)
[bugs://good] No URL provided! (Use `bugs.init` to set up the URL, or set process.env.BUGS_HOST_URL)

Configuration

You can configure the bugs-connector either by initializing it programmatically using the init method or by setting the following environment variables:

  • BUGS_HOST_URL: The URL of your Bugs server.
  • BUGS_DEFAULT_CHANNEL_ID: The default channel for logs.

Example

import Bugs from 'bugs-connector';

// Initialize Bugs with the server URL and default channel
bugs.init('https://your-bugs-server-url.com', 'general');

// Log a "bad" message
await bugs.bad('Critical failure in the payment system');

// Log a "good" message
await bugs.good('Payment processed successfully');

// Log a "warn" message in a specific channel
await bugs.warn('Low disk space on server', 'alerts');

License

This package is proprietary and intended for internal use with the Bugs logging server.