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

scoped-event-log

v3.0.0

Published

Global event log with scoped entries.

Readme

scoped-event-log

Scoped TypeScript Log provides a typed logging utility for JavaScript/TypeScript projects. All events logged by the utility require a named scope, which can be used to filter and remove events.

Usage

Install via NPM

npm i -S scoped-event-log

Import in JavaScript

import { Log } from 'scoped-event-log'
Log.add("DEBUG", "This is a logged debug event.", "scope")
// Or using a shorthand:
Log.debug("This is a logged debug event.", "scope")

Features

The package provides a global scope object Log that can be used to store, examine and export messages and events.

Events must be classified at one of the accepted priority levels (DEBUG, INFO, WARN, and ERROR). A special level DISABLE is not meant for event classification; it can be used as a threshold to prevent any log messages from being printed to the JavaScript console.

Suggested classification scheme:

  • DEBUG: Lowest level events meant to track the normal operation of the application.
  • INFO: Used to notify that an important operation has completed, for example a module or resource finishes loading.
  • WARN: Used when an expected issue prevents the application from fully performing, but not altogether stopping, an operation.
  • ERROR: Used when an (usually) unexpected issue prevents the application from continuing an operation.

Each of these levels have their own shorthand, namely Log.debug(), Log.info(), Log.warn(), and Log.error(). The three former accept as arguments a message and scope (both strings). The error shorthand also accepts a third argument for the actual Error that was thrown.

The base Log.add() method accepts an optional fourth argument extra that can hold anything related to the event.

Handling events from web workers

Since the worker opertes in a different scope than the main document, the Log objects imported in workers are separate objects. Since we don't want to maintain multiple instances of the object, all with their individual event buffers, we can register a worker to automatically relay all events from its Log to the Log where it's registered (i.e. the main document).

import { Log } from 'scoped-event-log'
const worker = new Worker()
Log.registerWorker(worker)
// Now all Log messages from worker are relayed to local Log.