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

hermodlog

v2.0.0

Published

Simple contextual logger to simplify log display in heavy load context and provide easy parsing

Readme

hermodlog

npm version

Stupid simple logging for JS but with context for heavy log environments.

This is just to only pass along a single logger instance between modules and have a hierarchical way to sort and display such modules.

Install

npm i hermodlog

Usage

import Logger from 'hermodlog';

const logger = new Logger({
    level: 'debug', // Optional, default: 'info'
});
const contextLogger = logger.context('Node#42');
const moduleLogger = logger.module('WSServer');
moduleLogger.method('init').log("Initializing server...");
const listenerLogger = moduleLogger.listener('onMessage');
listenerLogger.debug("Message received!");

API

Logger

new Logger(options)

Create a new logger instance.

Level methods

log(message, level)

Log a message with the given level.

debug(message)

Log a message with the debug level.

info(message)

Log a message with the info level.

warn(message)

Log a message with the warn level.

fatal(message)

Log a message with the fatal level.

error(message)

Log a message with the error level.

fatal(message)

Log a message with the fatal level.

Context methods

context(name)

Create a new context logger with the given context name.

module(name)

Create a new module logger with the given module name.

listener(name)

Create a new listener sublogger with the given listener name.

method(name)

Create a new method sublogger with the given method name.

child(name)

Create a new child logger with the given child name.

object(object)

Create a new object logger with the given object.

Other methods

clone(opts)

Clone the logger. The opts object can have the following properties:

  • keepHistory: Whether to keep the history of the logger. Default: false (unique falsy one).
  • keepContext: Whether to keep the context of the logger. Default: true.
  • keepModule: Whether to keep the module of the logger. Default: true.
  • keepListener: Whether to keep the listener of the logger. Default: true.
  • keepMethod: Whether to keep the method of the logger. Default: true.
  • keepObject: Whether to keep the object of the logger. Default: true.
  • keepChild: Whether to keep the child of the logger. Default: true.
  • keepLevel: Whether to keep the level of the logger. Default: true.
  • keepColors: Whether to keep the colors of the logger. Default: true.
  • keepDate: Whether to keep the date of the logger. Default: true.

constructor options

The options object can have the following properties:

date

A date-compatible format. Default: YYYY-MM-DD HH:mm:ss.SSS.

level

A default log level. Can be one of 'fatal', 'error', 'warn', 'info', 'debug', 'trace'. Default: info.

history

The history of the logger. Default: [].

contextName

The context name of the logger. Default: null.

moduleName

The module name of the logger. Default: null.

listenerName

The listener name of the logger. Default: null.

methodName

The method name of the logger. Default: null.

objectName

The object name of the logger. Default: null.

colors

An object where each key is a log level and the value is an array of colors for different parts of the log message. The array should have the following order: [date color, type color, context color, module color, listener color, method color, object color, string color, function color, number/default color].

{
    const options = {
        date: new Date('2024-01-01T00:01:01.001Z'),
        level: 'info', // Set the default log level
        colors: {
            // Set the colors for different parts of the log message
            fatal: [chalk.gray, chalk.red, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.magenta, chalk.white, chalk.blue, chalk.cyan],
            error: [chalk.gray, chalk.red, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.red, chalk.yellow, chalk.green, chalk.blue],
            warn: [chalk.gray, chalk.red, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.yellow, chalk.blue, chalk.magenta, chalk.red],
            info: [chalk.gray, chalk.red, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.blue, chalk.green, chalk.red, chalk.yellow],
            debug: [chalk.gray, chalk.red, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.green, chalk.red, chalk.yellow, chalk.blue],
            trace: [chalk.gray, chalk.red, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.magenta, chalk.yellow, chalk.blue, chalk.green],
        }
    };
    const logger = new Logger(options);
    
    logger.log('Hello World');
}

License

MIT