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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yingyeothon/logger-slack

v2.0.1

Published

Slack incoming-webhook LogWriter and Logger for the @yingyeothon/logger contract, batching records onto a single flushable promise chain.

Readme

@yingyeothon/logger-slack

Slack incoming-webhook backend for the @yingyeothon/logger contract. createSlackLogWriter returns a LogWriter that batches every record onto a single promise chain posting to the webhook, plus a flush() handle so serverless handlers can await delivery before exiting. createSlackLogger wraps it in a severity-filtered Logger. When webhookUrl is missing, Slack delivery is silently skipped; library code reads no environment variables — use slackLogWriterOptionsFromEnv() if you want the classic env-based configuration.

Install

npm install @yingyeothon/logger-slack

Usage

ESM:

import {
  createSlackLogger,
  slackLogWriterOptionsFromEnv,
} from "@yingyeothon/logger-slack";

const logger = createSlackLogger({
  webhookUrl: "https://hooks.slack.com/services/T000/B000/XXX",
  channel: "#alerts",
  userName: "yyt-bot",
  severity: "warn", // default; debug/info are filtered out
  withConsole: true, // also mirror records to the console
});

logger.info("request accepted", { requestId: "r-1" });
logger.error("request failed", { error: new Error("boom") }); // Error values are serialized.

// Or take webhookUrl/channel/userName from SLACK_WEBHOOK_URL etc.:
// const logger = createSlackLogger(slackLogWriterOptionsFromEnv());

// Wait for all queued Slack posts before the process exits.
await logger.flush();

CJS:

const { createSlackLogWriter } = require("@yingyeothon/logger-slack");
const writer = createSlackLogWriter({
  webhookUrl: process.env.SLACK_WEBHOOK_URL,
});
writer.warn("retrying", { jobId: 7 });
writer.flush().then(() => process.exit(0));

Each Slack message looks like [WARN] retrying followed by a fenced JSON block containing timestamp and context (the arguments after the message; omitted when there are none).

Public API

  • createSlackLogWriter(options?)LogWriter (debug/info/warn/error, variadic) plus flush(): Promise<void>; options: webhookUrl?, channel?, userName? (default "Logger"), maxTextLength? (default 24 KiB), onDeliveryError?.
  • createSlackLogger(options?) — severity-filtered Logger plus flush(); adds severity? (default "warn") and withConsole? (combine with consoleWriter) to the writer options.
  • slackLogWriterOptionsFromEnv() — opt-in helper reading SLACK_WEBHOOK_URL, SLACK_CHANNEL, SLACK_USER_NAME.
  • Types: SlackLogWriter, SlackLogWriterOptions, SlackLogger, SlackLoggerOptions.

Migrating from the legacy package

The package was renamed on npm: @yingyeothon/slack-logger@yingyeothon/logger-slack, and the API was redesigned around the shared @yingyeothon/logger contract.

  • Seven levels (tracesilent) became the shared four (debug, info, warn, error) with a severity filter ("none" disables everything); LogLevel, parseLogLevel, and toLogLevelName are gone.
  • Call style flipped from (context, message) to message-first variadic: logger.error("failed", { requestId }).
  • getLogger/useLogger/flushSlack/asYlogger were replaced by createSlackLogWriter/createSlackLogger; the adapter is unnecessary because the writer is a @yingyeothon/logger LogWriter.
  • Configuration is injected via options instead of read from process.env; use slackLogWriterOptionsFromEnv() to keep the env-driven behavior. CONSOLE_LOG_LEVEL/SLACK_LOG_LEVEL have no replacement — pass severity.
  • Pending Slack sends are stored per writer instead of in a module-global chain; call flush() on the writer/logger you created. Webhook failures are swallowed (report them via onDeliveryError), and the caller's context objects are no longer mutated when errors are serialized.
  • A typical port: getLogger("api", "handler.ts") + logger.error({ error }, "request failed") + await logger.flushSlack() becomes createSlackLogger(slackLogWriterOptionsFromEnv()) + logger.error("request failed", { error }) + await logger.flush().