@slack/logger
Logging utility used by Node Slack SDK
Last updated 8 months ago by GitHub Actions .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @slack/logger 
SYNC missed versions from official npm registry.

Slack Logger

codecov

The @slack/logger package is intended to be used as a simple logging interface that supports verbosity levels.

Requirements

This package supports Node v20 and higher. It's highly recommended to use the latest LTS version of node, and the documentation is written using syntax and features from that version.

Installation

$ npm install @slack/logger

Usage

This package exports a ConsoleLogger class, a generic Logger interface and a LogLevel enum. The source code is short (~150 lines of code), so check out src/index.ts for details, but the ConsoleLogger API mimics the default node console API with three additions:

  • getLevel(): returns the currently-specific LogLevel of the logger.
  • setLevel(LogLevel): sets the LogLevel of the logger.
  • setName(string): sets a prefix to display in logs. Useful if you have multiple loggers active.

Example

This short snippet shows various Logger levels and customized labels:

const { ConsoleLogger, LogLevel } = require("@slack/logger");

const logger = new ConsoleLogger();

logger.error("a problem happened");
logger.warn("might need attention");
logger.info("take note of this");
logger.debug("or dig into details");

logger.setName("HAL");
logger.setLevel(LogLevel.DEBUG);

logger.info("what an observation");
logger.debug("i am so interested");

When run, messages that match the following values are logged:

[ERROR]   a problem happened
[WARN]   might need attention
[INFO]   take note of this
[INFO]  HAL what an observation
[DEBUG]  HAL i am so interested

Getting Help

If you get stuck, we're here to help. The following are the best ways to get assistance working through your issue:

  • Issue Tracker for questions, feature requests, bug reports and general discussion related to this package. Try searching before you create a new issue.
  • Email us in Slack developer support: developers@slack.com

Current Tags

  • 5.0.0                                ...           latest (4 months ago)
  • 5.0.0-rc.1                                ...           rc (6 months ago)

9 Versions

  • 5.0.0                                ...           4 months ago
  • 5.0.0-rc.1                                ...           6 months ago
  • 4.0.1                                ...           8 months ago
  • 4.0.0                                ...           3 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.0                                ...           7 years ago
  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           8 years ago
Downloads
Total 27
Today 0
This Week 2
This Month 26
Last Day 0
Last Week 18
Last Month 1
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE