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

poplar-logger

v1.1.2

Published

lightweight logger, all are objects, with formatted-output script.

Downloads

22

Readme

poplar

A lightweight logger with the following features, and inpired by pino project.

  • all are objects
  • with formatted-output script

Install

npm install --save poplar-logger

Usage

Default exports

module.exports = Poplar;
module.exports.Logger = Logger;
module.exports.PrettyLogger = PrettyLogger;
module.exports.CacheLogger = CacheLogger;
  • Poplar: the poplar class
  • Logger: the default Logger instance
  • PrettyLogger: the Logger instance with pretty outputing
  • CacheLogger: the Logger instance with cache feature (faster)

Normally

'use strict'

const Poplar = require('./');

const Logger = new Poplar({});

Logger.trace('should Not be outputed');
Logger.info('Hello world.');

Logger.setLevel('trace');
Logger.trace({Hello: 'world'});
[{"d":1529647390433,"l":5,"t":"poplar"},{"t":1,"o":"Hello world."}]
[{"d":1529647390435,"l":2,"t":"poplar"},{"t":2,"o":{"Hello":"world"}}]

Pretty

'use strict'

const Poplar = require('./');

const Logger = new Poplar({
    pretty: true
});

Logger.trace('should Not be outputed');
Logger.info('Hello world.');

Logger.setLevel('trace');
Logger.trace({Hello: 'world'});
[2018-06-22T14:02:33.884+0800] INFO  poplar:
Hello world.
[2018-06-22T14:02:33.887+0800] TRACE poplar:
{
  "Hello": "world"
}

Pretty by Pipe

>node example.js | poplar.js -l trace -c text
[2018-06-23T12:06:00.180+0800] INFO  poplar:
Hello world.
[2018-06-23T12:06:00.181+0800] TRACE poplar:
{
  "Hello": "world"
}
[un-poplar] this is NOT poplar log.
  • -l: level, option

Options

Default options

const defaultOpts = {
    level: 'info',
    title: 'poplar',
    pretty: false,
    cache: 0,
    end: '\n',
    color: 'text',
    noTags: false

    output: process.stdout,
    writeCallback: undefined
};
  • level: logger level, supports 'trace', 'debug', 'info', 'warn', 'error' and 'fatal'
  • title: logger title
  • pretty: true indicates pretty formatted-outputing
  • cache: the size of cache buffer, 0 indicates NO cache
  • end: the end of log line
  • color: the color for outputing, supports 'text' and 'level'
  • noTags: true indicates do NOT show all tags, includes time,title,level fields
  • output: the stream for outputing
  • writeCallback: callback after log outputed

TypeScript

Ready, please refer to ./test/ts/base.ts

import { default as Poplar, Logger, PrettyLogger, CacheLogger } from 'poplar-logger'

Bechmarks

Basic

Log.Logger.info('Hello world');
Log.CacheLogger.info('Hello world');
Log.PrettyLogger.info('Hello world');
basic*10000: 599.941ms
cache*10000: 255.527ms
pretty*10000: 1517.173ms

Object

Log.Logger.info({"Hello": "world"});
Log.CacheLogger.info({"Hello": "world"});
Log.PrettyLogger.info({"Hello": "world"});
basic*10000: 686.868ms
cache*10000: 299.924ms
pretty*10000: 1578.868ms

Complex Array

const a = {
    b: 1,
    c: '1',
    d: {
        f: 2
    }
};
a.a = {
    m: 4,
    n: a.d
};
const array = [1, 'a', a, new Error('this is an error')];

Log.Logger.info(array);
Log.CacheLogger.info(array);
Log.PrettyLogger.info(array);
basic*10000: 1238.830ms
cache*10000: 717.515ms
pretty*10000: 3418.956ms