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

@gauravsharmacode/neat-logger

v2.0.0

Published

Production-grade structured logger for Node.js apps using Winston

Readme

neat-logger

A production-grade, structured logger for Node.js apps, built on Winston and designed for reusability across services. Version 2.0.0 introduces a class-based API, child loggers with bound context, and a new critical level — while keeping JSON output ready for log aggregation.


Purpose

  • Provide a simple, consistent logging API for services and libraries
  • Emit JSON logs suitable for ingestion (ELK, Datadog, etc.)
  • Support request/user context via child loggers
  • Keep console output human-readable during development

Features

  • JSON-structured logs with timestamp, level, message, and metadata
  • Levels: info, warn, error, debug, critical
  • Child loggers: bind context (e.g., requestId, userId) with .child()
  • Console + file transports (colorized console, JSON files)
  • Files written to logs/ in the project root: error.log (errors only) and combined.log (all logs)
  • TypeScript-first with strong types for level methods

Installation

Install from npm (package name placeholder):

npm install @gauravsharmacode/neat-logger

Local development usage:

# In this repo
npm install
npm run build

# Optionally link for local testing in another project
npm link
# Then in your project
npm link @gauravsharmacode/neat-logger

Quick start

import { logger } from '@gauravsharmacode/neat-logger';

logger.info('Service started');
logger.error('Operation failed', { code: 'E_FAIL' });

Context with child loggers

import { logger } from '@gauravsharmacode/neat-logger';

const reqLogger = logger.child({ requestId: 'req-123' });
reqLogger.info('Handling request', { path: '/api/users' });

const userLogger = reqLogger.child({ userId: 42 });
userLogger.warn('Profile incomplete');
userLogger.error('Save failed', { reason: 'validation' });

Critical level

logger.critical('Database unavailable', { db: 'primary' });

Repository usage (this repo)

  • Build the TypeScript sources:
npm run build
  • Run the example:
node example.js
  • Run tests:
npm test

Project structure

.
├─ src/
│  ├─ index.ts        # Public exports (Logger class, base instance)
│  └─ logger.ts       # Logger implementation (Winston setup, child, levels)
├─ dist/              # Build output (generated)
├─ tests/
│  └─ main.test.ts    # End-to-end logging test against combined.log
├─ example.js         # Runnable example (uses dist build)
├─ example.ts         # TypeScript example (imports from dist)
├─ jest.config.js     # Jest + ts-jest configuration
├─ tsconfig.json      # Library TS config
├─ tsconfig.test.json # Test TS config
└─ changes.md         # Changelog

How it works

  • Built on Winston with a custom level set that includes critical
  • Console transport is colorized and intended for local dev; file transports write JSON to logs/error.log and logs/combined.log
  • The base logger is an instance of Logger. Use child(defaultMeta) to create scoped loggers that automatically include your context
  • The implementation enriches logs with caller file/function using the JS stack; note that this may be tuned in future versions

Contributing

Contributions are welcome!

  • Issues: Open one with a clear description, steps to reproduce, and expected behavior
  • PRs: Keep changes focused. Include tests when applicable
  • Development workflow:
# Install deps
npm install

# Type-check and build
npm run build

# Run tests
npm test

# Run lints/format (if configured)
# npm run lint
# npm run format

Before submitting, please run the test suite and ensure example.js runs as expected.


License

MIT © Gaurav Sharma