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

@jenesei-software/jenesei-library-log

v2.0.0

Published

A lightweight logging library for Node.js and browser projects written in TypeScript or JavaScript.

Downloads

55

Readme

@jenesei-software/jenesei-library-log

A lightweight logging library for Node.js and browser projects written in TypeScript or JavaScript.

Features:

  • built-in log types;
  • colored console output based on log type;
  • stdout and stderr routing per message type;
  • browser-friendly console output;
  • custom log types;
  • separate logger instances for different services or modules.

Installation

npm i @jenesei-software/jenesei-library-log

Quick Start

import { logger } from '@jenesei-software/jenesei-library-log';

logger.info('Server started');
logger.success('Database connected');
logger.warn('Cache is disabled');
logger.error('Unexpected error', { code: 'E_DB' });
logger.debug('Payload', { page: 1, limit: 20 });

Example output:

[2026-04-18T03:10:52.109Z] [INFO] Server started
[2026-04-18T03:10:52.111Z] [SUCCESS] Database connected
[2026-04-18T03:10:52.112Z] [WARN] Cache is disabled

Default Types

The library ships with these log types:

  • info
  • success
  • warn
  • error
  • debug

Each type can be configured with:

  • label - console label text;
  • color - output color;
  • stream - stdout or stderr;
  • enabled - whether the type is enabled;
  • timestamp - whether this type includes a timestamp.

Creating a Custom Logger

import { createLogger } from '@jenesei-software/jenesei-library-log';

const appLogger = createLogger({
  name: 'api',
  timestamp: true,
});

appLogger.info('HTTP server is ready');
appLogger.error('Cannot connect to Redis');

Output will look like this:

[2026-04-18T03:12:41.000Z] [api] [INFO] HTTP server is ready

Overriding Default Types

import { createLogger } from '@jenesei-software/jenesei-library-log';

const logger = createLogger({
  types: {
    info: {
      label: 'LOG',
      color: 'cyan',
    },
    debug: {
      enabled: false,
    },
  },
});

logger.info('Custom info message');
logger.debug('This line will not be printed');

Adding Custom Types

You can add your own types when creating the logger:

import { createLogger } from '@jenesei-software/jenesei-library-log';

const logger = createLogger({
  types: {
    http: {
      label: 'HTTP',
      color: 'magenta',
    },
    audit: {
      label: 'AUDIT',
      color: 'white',
    },
  },
});

logger.log('http', 'GET /users', 200);
logger.log('audit', 'User deleted', { id: 42 });

Or register a new type later:

import { createLogger } from '@jenesei-software/jenesei-library-log';

const logger = createLogger();

logger.registerType('queue', {
  label: 'QUEUE',
  color: 'brightMagenta',
});

logger.queue('Job started', { id: 'job-1' });
logger.log('queue', 'Job finished');

Available Colors

Supported values:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • gray
  • brightRed
  • brightGreen
  • brightYellow
  • brightBlue
  • brightMagenta
  • brightCyan
  • brightWhite

You can also pass your own color function:

import { createLogger } from '@jenesei-software/jenesei-library-log';

const logger = createLogger({
  types: {
    metric: {
      label: 'METRIC',
      color: (message) => `\u001B[36m${message}\u001B[0m`,
    },
  },
});

logger.log('metric', 'Requests per second', 128);

Runtime Control

import { createLogger } from '@jenesei-software/jenesei-library-log';

const logger = createLogger();

logger.setTypeEnabled('debug', false);
logger.setColorsEnabled(false);

Useful methods:

  • logger.log(type, ...messages) - log a message by type name;
  • logger.registerType(type, config) - add a new type;
  • logger.hasType(type) - check whether a type is registered;
  • logger.getTypes() - get the current type map;
  • logger.setTypeEnabled(type, enabled) - enable or disable a type;
  • logger.setColorsEnabled(enabled) - enable or disable colors.

Using It in Node.js

Example for a simple Node.js service:

import { createServer } from 'node:http';
import { createLogger } from '@jenesei-software/jenesei-library-log';

const logger = createLogger({
  name: 'node-app',
  types: {
    http: {
      label: 'HTTP',
      color: 'brightCyan',
    },
  },
});

const server = createServer((request, response) => {
  logger.log('http', request.method, request.url);
  response.end('ok');
});

server.listen(3000, () => {
  logger.success('Server started on port 3000');
});

Using It in the Browser

import { createLogger } from '@jenesei-software/jenesei-library-log';

const logger = createLogger({
  name: 'web-app',
  types: {
    ui: {
      label: 'UI',
      color: 'brightMagenta',
    },
  },
});

logger.info('Application booted');
logger.log('ui', 'Sidebar opened');
logger.error('Unexpected client error', new Error('Network timeout'));

In the browser, the logger uses console.log and console.error, and built-in colors are rendered with %c styles.

Notes

  • In Node.js, colors are automatically disabled when the console does not support TTY.
  • If the NO_COLOR environment variable is set, colored output is disabled.
  • error and warn use stderr by default.
  • In the browser, stdout maps to console.log and stderr maps to console.error.