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

arc-logger

v1.1.0

Published

Small library for controlled environment based logging

Readme

Arc Log*

*This readme was AI generated

Arc Log is a lightweight, environment-aware logging and profiling library for Node.js.
It provides colorized console logs for development, structured logging for production, and simple profiling utilities with performance thresholds.


📦 Installation

npm install arc-logger

🧭 Overview

Arc Log adapts automatically to your environment:

  • Development → Colorized and human-friendly console logs.
  • Staging → Controlled logs with optional bypass list for debugging specific labels.
  • Production → Structured logs for analysis and aggregation, with optional custom transport.

It also includes a profiling API for performance measurement and supports detailed error tracing with V8 stack inspection or regex fallback.


🚀 Quick Start

import Log from 'arc-log';

// Set up your logger
Log.setServiceName('my-service');
Log.setEnvironment('production');
Log.enableProductionLogging(true);

// Log to console or a custom destination
Log.setDestination('console');

// Log some events
Log.info('Server started', { port: 8080 });
Log.ops('User signup', { userId: 123 });
Log.warning('Cache miss rate high', { rate: 0.42 });
Log.error('Unexpected exception', { err });

// Error handling helper
try {
  throw new Error('Database connection failed');
} catch (err) {
  Log.catch(err, { traceId: 'TRACE-1' });
}

⚙️ Environment Configuration

| Environment | Logging Enabled | Profiling Enabled | Default Threshold | Notes | |---------------|----------------|------------------|-------------------|-------| | Development | ✅ Yes (colorized console) | ✅ | 0 (debug+) | Always prints to console | | Staging | ⚙️ Configurable | ⚙️ Configurable | 1 (info+) | Can bypass labels | | Production | ⚙️ Configurable | ⚙️ Configurable | 2 (ops+) | Ideal for structured logging |

Example (Custom Transport)

const customTransport = (service, record) => {
  // Send logs to remote collector
  console.log('Sending to collector:', service, record);
};

Log.setEnvironment('production');
Log.enableProductionLogging(true);
Log.setDestination('custom', customTransport);

Log.critical('Payment system offline', { status: 500 });

🧩 Profiling

Profile sections of your code and automatically log aggregate timings.

Log.setEnvironment('production');
Log.enableProductionLogging(true);
Log.enableProductionProfiling(true);
Log.setDestination('custom', myTransport);

const id = Log.profile('db-query', { query: 'SELECT * FROM users' }, { 
  profileThresholds: { critical: 1000, warning: 500, info: 200 },
  sendAggregate: 1
});

// Simulate work
await runQuery();

Log.profileEnd(id);

Behavior:
When profiling ends, Arc Log aggregates timings and logs with mapped severity levels depending on the configured thresholds.


🧱 Catching Errors

Log.catch() automatically extracts filename, line, and column using V8’s structured stack API when available, or a regex fallback otherwise.

try {
  throw new Error('Fatal: connection refused');
} catch (e) {
  Log.catch(e, { traceId: 'ABC-123' });
}

If the environment is production and logging is enabled, the structured record will be delivered to your destination.


🧰 Advanced Features

Instance Facades

const scoped = Log.instance({ traceId: 'REQ-123' });
scoped.info('Request handled');
scoped.ops('Cache updated', { cache: true });
scoped.catch(new Error('Worker timeout'));

Each instance applies the given config automatically (like traceId or threshold).

Bypass Lists

Log.addToProductionBypassList('debug-label');
Log.debug('debug-label', { extra: 'visible in prod now' });

Bypass lists allow certain labels to always log even if the current environment or threshold would normally filter them.

Development Output Options

Log.setSimpleOutput(true);  // One-line messages
Log.setOutputRaw(true);     // Print raw JSON or values directly

🧪 Testing

This module has a comprehensive Jest test suite covering:

  • All environments (dev/staging/prod)
  • Thresholds and bypass logic
  • Profiling aggregation
  • Error capture with V8 and regex fallback
  • Console vs custom destinations

Run tests with:

npm test

📄 License

MIT License

This project is released under The Unlicense, placing it in the public domain.