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

sentinal-monitor

v0.0.6

Published

A lightweight, framework-agnostic JavaScript logging SDK that captures logs, errors, and exceptions from client-side and server-side applications and forwards them to the Sentinal log ingestion API.

Readme

Sentinal JS SDK

A lightweight, framework-agnostic JavaScript logging SDK that captures logs, errors, and exceptions from client-side and server-side applications and forwards them to the Sentinal log ingestion API.

Features

  • Universal: Works in both Node.js and browser environments with the same API.
  • Automatic Error Capture: Captures console output, unhandled errors, and promise rejections.
  • Efficient: Buffers logs and sends them in batches to reduce network traffic.
  • Resilient: Retries sending logs with backoff on network failure.
  • Context-Aware: Enrich logs with custom metadata (e.g., user, session, or transaction IDs).
  • Tiny & Tree-Shakeable: Minimal footprint for client-side applications.

Installation

npm install sentinal-monitor
# or
yarn add sentinal-monitor

Quick Start

You must initialize the SDK once at your application's entry point.

In a Browser App (e.g., React, Vue, Svelte)

In your main index.js or main.ts:

import { initSentinal } from 'sentinal-monitor';

initSentinal({
  projectKey: 'YOUR_PROJECT_KEY',
});

// All console logs, warnings, and errors will now be captured automatically.
console.log('Hello from the browser!');

In a Node.js App (e.g., Express, NestJS)

In your main entry file (e.g., server.js, index.js, main.ts):

import { initSentinal } from 'sentinal-monitor';

initSentinal({
  projectKey: 'YOUR_PROJECT_KEY',
});

// The rest of your application...
console.log('This log will be captured by Sentinal.');

How It Works: Universal Imports

The Sentinal SDK is designed to be universal. You can use the same import statement in any project, and the correct version (browser or Node.js) will be used automatically.

import { initSentinal, log, setContext } from 'sentinal-monitor';

This is made possible by the "exports" field in package.json, which tells Node.js and modern bundlers which files to use based on the environment. You never need to change your import path.


API Reference

initSentinal(config)

Initializes the SDK. This must be called once before any other SDK functions.

| Key | Type | Required | Description | | --------------- | ------------- | :------: | --------------------------------------------------------------------------- | | projectKey | string | ✅ | Your Sentinal project key. | | apiUrl | string | ❌ | Custom API endpoint for self-hosted Sentinal instances. | | flushInterval | number (ms) | ❌ | How frequently to flush the log buffer. Default: 2000. | | bufferLimit | number | ❌ | Maximum number of logs to buffer before flushing. Default: 10. | | retries | number | ❌ | Number of retry attempts on network failure. Default: 3. | | sandbox | boolean | ❌ | Enable sandbox mode for local development. Default: false. | | context | object | ❌ | Global key-value pairs to attach to every log. | | serviceName | string | ❌ | A name for your application. Inferred automatically if not set. |

log(level, ...args)

Manually sends a log to Sentinal.

  • level: 'log' | 'info' | 'warn' | 'error' | 'debug'
  • ...args: One or more values to log (e.g., strings, objects).
import { log } from 'sentinal-monitor';

log('info', 'User has signed up', { userId: '12345' });

setContext(context)

Enriches all subsequent logs with the provided key-value pairs. This is useful for adding session or user information.

  • context: An object with data to merge into the global context.
import { setContext } from 'sentinal-monitor';

// Set user information after login
setContext({
  user: {
    id: 'user-99',
    email: '[email protected]',
  },
});

console.log('User context has been set.'); // This log will include the user data

Debugging and Local Development

Seeing Internal SDK Logs

To see what the Sentinal SDK is doing internally (e.g., when it's flushing logs), you can enable its internal logger.

  • In the browser:
    // Open the developer console and run:
    localStorage.setItem('sentinal_DEBUG', 'true');
  • In Node.js:
    # Set an environment variable before running your app:
    export SENTINAL_DEBUG=true
    node your-app.js

Using Sandbox Mode

For local development, it's highly recommended to use the sandbox flag. This prevents your development logs from being mixed with production data.

initSentinal({
  projectKey: 'YOUR_PROJECT_KEY',
  sandbox: true, // Enable sandbox mode
});

When sandbox is true, the SDK will automatically point to a local or development-specific Sentinal endpoint, which you can configure with the apiUrl option if needed.

License

MIT