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

mnr-logger

v3.0.1

Published

Opinionated logger for Node.js

Readme

mnr-logger

Opinionated logger for Node.js

You may not need it!

This is a highly opinionated solution aimed at code reuse for a few private projects. You'd be better off using something popular, like winston and friends.

v3 Breaking Changes

  • From v3, mnr-logger is an ESM-only module - you are not able to import it with require().

  • Bump minimum supported version of Node.js to v20.

  • Change type of meta parameter from any to unknown.

Archive documentation:

Installation

$ npm install --save mnr-logger

Usage example

import mnrLogger from 'mnr-logger';

const logger = mnrLogger({
  appName: 'my-cool-app',
  deploymentEnv: 'production'
});

const ERR = new Error('something went wrong');

logger.error(ERR, { transactionId: '12345' });
logger.warn(ERR, { transactionId: '12345' });
logger.info('take a look at foo stuff', { transactionId: '12345' });

What It Does

mnr-logger sends log messages to stderr (for error method), or stdout (for warn and info methods).

When process.env.NODE_ENV !== 'production', mnr-logger logs directly to stdout/stderr without any care how many lines it occupies. This is for development mode.

When process.env.NODE_ENV === 'production', mnr-logger creates a POJO with all the pieces of information it has received, then JSON.stringifies it, and sends to stdout/stderr a single line of text. This allows to treat every single line in your logs storage as one logging item and automate processing. After JSON.parsing this string, you'll get a POJO of the following form:

  • {ISO Date string} timestamp - Timestamp of the moment mnr-logger received the message.

  • {String} appName - Application name that mnr-logger was initialized with.

  • {String} deploymentEnv - Application deployment environment label that mnr-logger was initialized with.

  • {String} level - "error" for error() method; "warn" for warn() method; "info" for info() method.

  • {String} error - JSON.stringified Error object that was sent to error() or warn() methods. You can JSON.parse it further to get a pretty formatted representation of the error.

  • {Any} meta - Optional. Additional information that was sent to the logger.

  • {String} message - Message passed to info() method.

API Reference

mnrLogger(opts: object)

Create a logger instance. You can create as many logger instances as you need in your app.

  • {String} opts.appName - [optional] Application name tag. Defaults to an empty string

  • {String} deploymentEnv - [optional] Application deployment environment tag. Defaults to an empty string

Returns logger instance with error, warn, and info methods.

logger.error(error, [meta])

Logs an error (with some meta data) into stderr.

Parameters:

  • {Error} error - Error to log

  • {Any} [meta] - [optional] Any JSON-serializable data.

logger.warn(error, [meta])

Logs an error (with some meta data) into stdout.

Parameters:

  • {Error} error - Error to log

  • {Any} [meta] - [optional] Any JSON-serializable data.

logger.info(message, [meta])

Logs an arbitrary text message (with some meta data) into stdout.

Parameters:

  • {String} message

  • {Any} [meta] - [optional] Any JSON-serializable data.