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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pepper-log

v0.17.811

Published

A simple console logging utility for node.js.

Downloads

1

Readme

Pepper Log

GitHub license npm Version 0.17.810 GitHub issues

Terminal Screenshot

Contains some necessary console logging functionalities for you so you could focus more on what's important - building awesome apps.

Installation

npm install pepper-log

What's in the box?

  • Timestamp - Basically, you should know when the log occured.
  • Basic Colors - An effective attention grabber for important matters.
  • Headers - Useful when creating sections.
  • Separator Lines - Quickly generate line separators with a single function call.
  • Indention - Useful for nested logs.

Usage

Sample code

var log = require('pepper-log');

log.setLineChar('=');
log.endl()
   .header('Pepper.IO Industries')
   .out('Thank you for using Pepper Log!')
   .out('Version 0.17.810\n')
   .plain('Simple to use library for basic console logging.')
   .plain('Run `npm install pepper-log` to use this package.')
   .plain('Import it to your code using `var log = require("pepper-log");`')
   .line('-')
   .info('Loading components...', 'Pepper Log: ', true)
   .ok('Network module loaded.')
   .ok('Compression module loaded.')
   .ind(2).info('Using gzip compression.')
   .ok('Display module loaded.')
   .ind(2).warn('The display supports only 256 colors.')
   .ind(2).err('No compatible graphics driver detected.')
   .line().showDate()
   .ok('All systems operational.', '', true).endl();

Import the package to your code

var log = require('pepper-log');

No timestamp output

Syntax | Description --- | --- log.out(message) | Basically a console.log call, but shorter (if your require variable is short, that is).

log.out('Hello, world!');
// → Hello, world!

Timestamped output

Syntax | Description --- | --- log.plain(message) | Produces a console output with timestamp with "plain" status. log.showDate(bool) | By default, the system time will only be shown on a timestamped output. Succeeding timestamped logs will be affected.

log.plain('Hey, something just happened.');
// → [15:33:04] Hey, something just happened.

log.showDate(true);
log.plain('Hey, something just happened.');
// → [8/11/17 16:14:38] Hey, something just happened.

Common status logs

Also a timestamped output, but with extra status message and colors.

Status | Syntax | Color | Description --- | --- | --- | --- OK | log.ok(message) | Green | Asserts an affirmative tone to your message. Info | log.info(message) | Blue | For gentle reminders. Warning | log.warn(message) | Yellow | Used for cautions or for requesting close attention. Error | log.err(message) | Red | For errors or critial events that needs immediate response from the user.

log.info('Thanks for using Pepper Log!');
log.ok('The program exited with a 0 status.');
log.warn('You\'re using a deprecated version of this package. Please consider updating.');
log.err('Cannot divide by 0.');

// → [12:28:06] Info: Thanks for using Pepper Log!
// → [12:28:06] OK: The program exited with a 0 status.
// → [12:28:06] Warning: You're using a deprecated version of this package. Please consider updating.
// → [12:28:06] Error: Cannot divide by 0.

By default, the color is applied from the timestamp until the colon (:) of the status message. Your message will use the default terminal color.

If you want to apply the status' color to the whole line, you may need to set the second optional parameter to true. The first optional parameter gives you the ability to customize the status message.

log.ok|info|warn|err(message [, status = 'Info: ' [, colorline = false]])

Optional Arg | Description --- | --- status | The status message. colorline | Determines if the whole line should be colored.

log.ok('Complete.', 'Download Daemon: ');
log.info('The blue color also affects this text.', 'Blueify: ', true);
log.warn('I use the default status message and the color spans up to this point.', undefined, true);

// → [06:45:42] Download Daemon: Complete.
// → [06:45:42] Blueify: The blue color also affects this text.
// → [06:45:42] Warning: I use the default status message and the color spans up to this point.

Line separators

Draw a horizontal line. By default, it uses the dash "-" character.

log.line([char = '-' [, width = default_width]])

Optional Arg | Description --- | --- char | The character to use for drawing the line. Dash "-" is set as default. width | The width/length of the line in characters.

log.line();
log.line('=');
log.line(undefined, 12);

// → ------------------------------
// → ==============================
// → ------------

The global line width is set to 30. To change it:

log.setLineWidth([number = 30])

You can also change the global line character:

log.setLineChar([char = '-'])

log.setLineWidth(18);
log.setLineChar('+');
log.line();

// → ++++++++++++++++++

Headers

Useful for creating sections. The header caption/text is separated by top and bottom lines that use the line() function, thus the global line width and character affects the header lines.

Syntax | Description --- | --- log.heading(caption [, margin = 0 [, padding = 0]]) | Outputs the caption

Optional Arguments

Optional Arg | Description --- | --- margin | The no. of lines outside the header lines. padding | The no. of lines from the header text to the header lines.

log.header("Contributions and credits");
log.out('Some text before.');
log.setLineWidth(40);
log.header('A wide header', 1, 2);
log.out('Some text after.');

// → ------------------
// → Contributions and credits
// → ------------------
// → Some text before.
// → 
// → ----------------------------------------
// → 
// → 
// → A wide header
// → 
// → 
// → ----------------------------------------
// → 
// → Some text after.

Empty line

Output an empty line or to give some space between logs.

log.endl([lines = 1])

Optional Arg | Description --- | --- lines | The number of empty lines to output.

log.endl(4);

// →
// →
// →
// →

Indention

Need hierarchy logs? You can indent logs using the ind() function. By default, it uses two spaces (' ') as the indent/tab character.

log.ind([indent_count = 1 [, indent_char = m_indentchar]])

Optional Arg | Description --- | --- indent_count | How many times the indent will be applied. indent_char | The character to be used to indent the output.

Note: The indent will only be applied to the next output.

log.info('Starting services...');
log.ind(2);
log.ok('Service 1 started.');
log.ind(2);
log.ok('Service 2 started.');
log.info('All services started successfully.');
log.warn('Service 1 is experiencing a heavy traffic.');
log.ind(2, '>>');
log.plain('Service 1 is now running on priority mode.');

// → [03:39:51] Info: Starting services...
// →   [03:39:51] OK: Service 1 started.
// →   [03:39:51] OK: Service 2 started.
// → [03:39:51] Info: All services started successfully.
// → [03:39:51] Warning: Service 1 is experiencing a heavy traffic.
// → >>>>[03:39:51] Service 1 is now running on priority mode.

Chaining

You can immediately call another Pepper Log function after the previous one.

log.header('Pepper.IO Industries')
   .plain('Loading components...');

// → ------------------------------
// → Pepper.IO Industries
// → ------------------------------
// → [14:05:06] Loading components...