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

penlog

v2.0.0

Published

A simple and powerful logger for nodejs.

Readme

Build Status Coverage Status

> npm install penlog --save
> yarn install penlog --save
import { penlog, colors } from 'penlog'

penlog.log(colors.red('hello'), 4).log(colors.blue('world!'), 4)

Class Penlog

Constructor Options

options: {
  // where you want to write message, the default value is process.stdout
  stdout: process.stdout
  // where you want to write error message, the default value is process.stderr
  stderr: process.stderr
  // the indent size of per line,the default value is zero
  indent: 0
}

static createPenlog([[key, ]options])

import { createPenlog } from 'penlog'

createPenlog() !== createPenlog()
createPenlog({ indent: 2 }) !== createPenlog({ indent: 4 })
createPenlog('pen1') === createPenlog('pen1')
createPenlog('pen1') !== createPenlog('pen2')

createPenlog will return a instance if Penlog Class. If you don't provide the key option, it will return different instance every time.

write([content[, title][, options]])

import { penlog } from 'penlog'

penlog
  .write('hello world!')
  .write('OK!', { indent: 4 })
  .writeln()
  .write('Yes, Sir!')

// -- output --
/*
hello world!    OK!
Yes, Sir!
*/
  • contents: can be a string or array, when it is an array, it will be used by util.format.

  • title: can be a string.

  • options:

    • style: the style for multi-line content. default means that before of pre-line content will be empty; space means that before of pre-line content will be white space; title means that before of pre-line content will be title. The default value is default.
    • error: whether to use stderr instead stdout. The default value is false.
    • indent: the length of indentation before this log. The default value is zero.
    • join: the string for concat pre-line content. The default value is \n.
    • newline: whether output \n at the end of log, the default value is false.
    • space: the string between title and content. The default value is white space.

writeln([content[, title][, options]])

This is same as write(), but options.newline is true.

log([content[, title][, options]])

import { penlog } from 'penlog'

penlog
  .log('line1')
  .log('line2')
  .log('line3', 'title')
  .log('line4\nline5', 'title4-5')
  .log('line6\nline7', 'title6-7', { style: 'default' })

// -- output --
/*
line1
line2
title line3
title4-5 line4
         line5
title6-7 line6
line7

*/
import { penlog } from 'penlog'

penlog.log('line1\nline2', { join: '|' })

// -- output --
/*
line1|line2

*/
import { penlog } from 'penlog'

penlog.log('line1\nline2', { indent: 4 })

// -- output --
/*
    line1
    line2

*/

info([contents[, title][, options]])

import { penlog } from 'penlog'

penlog
  .info('information1')
  .info('information2-1\ninformation2-2')
  .info('information3', ' I ')

info-1

warn([contents[, title][, options]])

import { penlog } from 'penlog'

penlog
  .warn('warning1')
  .warn('warning2-1\nwarning2-2')
  .warn('warning3', ' W ')

warn-1

error([contents[, title][, options]])

import { penlog } from 'penlog'

penlog
  .error('error1')
  .error('error2-1\nerror2-2')
  .error('error3', ' E ')

error-1

success([contents[, title][, options]])

import { penlog } from 'penlog'

penlog
  .success('success1')
  .success('success2-1\nsuccess2-2')
  .success('success3', ' S ')

success-1

indent([number = 2])

import { penlog } from 'penlog'

penlog
  .indent(4)
  .log('line1')
  .indent(4)
  .log('line2')
  .indent(-4)
  .log('line3')

// -- output --
/*
    line1
        line2
    line3

*/

Indent output with size number.

table(rows[, options])

table is exported from package text-table

loding(text[, options])

loading is exported from package ora

colors

import { colors } from 'penlog'

colors is exported from package colors/safe

symbols

import { symbols } from 'penlog'

symbols is exported from package log-symbols

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

penlog © blackcater, Released under the MIT License. Authored and maintained by blackcater with help from contributors (list).

http://www.blackcater.win · GitHub @blackcater