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 🙏

© 2024 – Pkg Stats / Ryan Hefner

debugnyan

v4.1.1

Published

A logging library that combines the simplicity and convenience of debug with the power of bunyan

Downloads

71,699

Readme

debugnyan

A logging library that combines the simplicity and convenience of debug with the power of bunyan.

Status

npm version build status

Installation

Install the package via yarn:

❯ yarn add debugnyan

or via npm:

❯ npm install debugnyan --save

Usage

Create a logger by giving it a namespace and then call bunyan's log methods on the returned instance.

By default, similarly to debug's behaviour, loggers do not output any content. Each logger output can be selectively activated by using the DEBUG environment variable. Pattern matching is based on the logger's name and it can optionally contain colons (:) to create (sub)-components properties on the logger instance.

Consider a logger named foo:bar:biz:

  • this creates a bunyan logger with name foo
  • and a bunyan (simple) child logger with property component equal to bar.
const logger1 = require('debugnyan')('foo');
const logger2 = require('debugnyan')('foo:bar');

logger1.debug('net');
logger2.debug('qux');

Example output with DEBUG=foo:

DEBUG=foo node example.js

{"name":"foo","hostname":"ruimarinho","pid":1,"level":20,"msg":"net","time":"2016-10-04T18:54:14.530Z","v":0}
{"name":"foo","hostname":"ruimarinho","pid":1,"component":"bar","level":20,"msg":"qux","time":"2016-10-04T18:54:14.531Z","v":0}

Example output with DEBUG=foo:bar:

DEBUG=foo:bar node example.js

{"name":"foo","hostname":"ruimarinho","pid":2,"component":"bar","level":20,"msg":"qux","time":"2016-10-04T18:55:08.217Z","v":0}

The prefix and suffix for each component is also customizable:

const logger = require('debugnyan')('foo', {}, { suffix: 'module' });

When creating a child logger you may also override the default simple behavior:

const logger = require('debugnyan')('foo', {}, { suffix: 'module', simple: false });

Log level

The level bunyan option is respected if the logger output is active.

const logger = require('debugnyan')('foo', { level: 'info' });

You may also set the log level via the LOG_LEVEL environment variable. However, the level option will always take precedence over it.

Tests

❯ yarn test

Release

Click Run Workflow on the release github action.

License

MIT