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

rear-logger

v1.0.0

Published

[![Build Status](https://travis-ci.org/rearjs/rear-logger.svg?branch=master)](https://travis-ci.org/rearjs/rear-logger)

Readme

rear-logger

Build Status

A logger for Rear projects.

How it works

Create a logger with name and options, then start logging on the predefined levels: success, info, warn, debug and error.

Level names can be added or customized by providing a key/value map with level name and color string in the levels option. You can also specify both terminal and browser colors by providing an Array with both values as shown below.

const createLogger = require('rear-logger');

const name = 'MyAwesomeLogger';
const options = {
  showName: true,
  showDiffLabel: true,
  levels: {
    hint: ['cyan', 'color: cyan'] // or just 'cyan'
  }
};

const logger = createLogger(name, options);
logger.hint('Logger "%s" created with options: %O', name, options);

Default Levels

|Name |Color | |-------|-----------| |log |white | |none |white | |debug |magenta | |info |blue | |success|green | |hint |yellow | |warn |yellow | |warning|yellow | |error |red | |quit |red | |GET |bold_green | |POST |bold_yellow| |PUT |bold_blue | |DELETE |bold_red | |OPTIONS|bold_cyan |

Logger Options

|Name |Type |Default|Description | |--------------|---------|-------|---------------------------------------------| |enabled |[bool] |true |Enable or disable the logger output | |showName |[bool] |false |Prefix logger's name to the logged output | |nameColor |[Array] | |Define logger's name color | |showLevelName |[bool] |true |Print the log level in logged output | |showTimeLabel |[bool] |false |Print the current time in the logged output | |showDiffLabel |[bool] |false |Print the diff time from last logged messaged| |formatters |?object |{} |Accept additional text formatters | |codeMap |[object] ||Define additional code map (i.e. emoji-codes)| |disableCodeMap|[bool] |false |Define code-map conversion (i.e. emoji-codes)| |levels |?object |{} |Define key/value level name and color pairs | |stdout |?function| |Custom stdout | |stderr |?function| |Custom stderr |

API

constructor (name: string, props: RearLoggerProps)

Create a new logger with given name and options.

Parameters

raw (message: string, ...args: Array): void

Print a message directly to the stdout much like a standard console.log would do.

Parameters

message (level: string, message: string, ...args: Array): void

Format and print a message for the given level. Note: usually is more convenient to call the logger's level function as in logger.info('Hello world')

Parameters

warn (assert?: boolean, message: string, ...args: Array): void

Format and print a warning message. When an assert is provided, the message is conditionally printed based on the truthyness of the assertion.

Parameters

error (message: string|Error, ...args: Array): void

Format and print an Error's message or a given message to the stderr.

Parameters

debug (message: string, ...args: Array): void

Format and print a debug message. The DEBUG environment variable is used to show or hide this message based on space or comma-delimited names.

The * character may be used as a wildcard. For example: DEBUG=myLogger:*

For example:

export DEBUG="firstLogger:*"
const firstLogger = require('logger')('firstLogger:section');
const secondLogger = require('logger')('secondLogger:section');

firstLogger.debug('This message will be printed to stdout');
secondLogger.debug('This message will NOT be printed to stdout');

Note: Set the DEBUG variable in the localStorage if you are using the library from a browser.

Parameters

highlight (message: string, ...args: Array): void

Format and print the given message as highlighted. An highlighted message is bold and do not print time information.

Parameters

async prompt (opts?: Object, message: string, ...args: Array): Promise

Async prompt user for input in the console and resolve with the user answer.

Parameters

async question (opts?: Object, message: string, ...args: Array): Promise

Same as prompt, but prefix a question level header to the message.

Parameters

Returns

clear (): void

Clear the console

clearLine (): void

Clear the current line.

rewriteLine (lines: number, clear?: boolean): void

Move the cursor up for the given number of lines.

Parameters

hideCursor (): void

Hide the cursor in the console.

showCursor (): void

Restore cursor visibility in the console.