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

@letumfalx/debug-logger

v0.2.0

Published

A wrapper for visionmedia/debug package.

Downloads

4

Readme

Debug Logger

A wrapper for visionmedia/debug package. This maps the package to the five console debug level:

  • debug
  • error
  • info
  • log
  • warn

Installation

npm install @letumfalx/debug-logger

Usage

Basic Usage

// import the package
var Logger = require('@letumfalx/debug-logger');

// create an instance
var logger = new Logger('namespace');

// log
logger.debug('logs on "debug" channel');
logger.error('logs on "error" channel');
logger.info('logs on "info" channel');
logger.log('logs on "log" channel');
logger.warn('logs on "warn" channel');

Above will output:

  namespace:debug logs on "debug" channel +0ms
  namespace:error logs on "error" channel +0ms
  namespace:info logs on "info" channel +0ms
  namespace:log logs on "log" channel +0ms
  namespace:warn logs on "warn" channel +0ms

Passing Configs

// import the package
var Logger = require('@letumfalx/debug-logger');

// create an instance
var logger = new Logger('namespace', {
  separator: '-',
  baseNamespace: 'base'
});

// log
logger.debug('logs on "debug" channel');
logger.error('logs on "error" channel');
logger.info('logs on "info" channel');
logger.log('logs on "log" channel');
logger.warn('logs on "warn" channel');

Above will output:

  base-namespace-debug logs on "debug" channel +0ms
  base-namespace-error logs on "error" channel +0ms
  base-namespace-info logs on "info" channel +0ms
  base-namespace-log logs on "log" channel +0ms
  base-namespace-warn logs on "warn" channel +0ms

Extending the Instance

You can extend the logger, appending the namespace to the namespace of the base logger.

var Logger = require('@letumfalx/debug-logger');
var logger = new Logger('namespace');
var extendedLogger = logger.extend('extend');

// log
extendedLogger.debug('logs on "debug" channel');
extendedLogger.error('logs on "error" channel');
extendedLogger.info('logs on "info" channel');
extendedLogger.log('logs on "log" channel');
extendedLogger.warn('logs on "warn" channel');

Above will output:

  namespace:extend:debug logs on "debug" channel +0ms
  namespace:extend:error logs on "error" channel +0ms
  namespace:extend:info logs on "info" channel +0ms
  namespace:extend:log logs on "log" channel +0ms
  namespace:extend:warn logs on "warn" channel +0ms

Overriding Config on Extend

You can extend the logger, appending the namespace to the namespace of the base logger.

var Logger = require('@letumfalx/debug-logger');
var logger = new Logger(['base', 'namespace']);
var extendedLogger = logger.extend('extend', {
  separator: '-'
});

// log
extendedLogger.debug('logs on "debug" channel');
extendedLogger.error('logs on "error" channel');
extendedLogger.info('logs on "info" channel');
extendedLogger.log('logs on "log" channel');
extendedLogger.warn('logs on "warn" channel');

Above will output:

  base:namespace-extend-debug logs on "debug" channel +0ms
  base:namespace-extend-error logs on "error" channel +0ms
  base:namespace-extend-info logs on "info" channel +0ms
  base:namespace-extend-log logs on "log" channel +0ms
  base:namespace-extend-warn logs on "warn" channel +0ms

Notes:

  • baseNamespace cannot be overridden, it will always be the current namespace of the base namespace.
  • separator will only affect the new appending namespaces.

Configurations

This are the configuration to be used for creating logger.

{
  channels: {
    debug: Function,
    error: Function,
    info: Function,
    log: Function,
    warn: Function
  },
  baseNamespace: String,
  separator: String
}

channels

This are the functions to be called to log messages. By default this will be the console channels ( ex: debug: console.debug.bind(console) ).

baseNamespace

The namespace to be prepended to the passed namespace.

Example:

namespace: 'namespace'
baseNamespace: 'base'
result: 'base:namespace'

separator

The separator to be used for appending the namespaces.

Default Values

{
  channels: {
    debug: console.debug.bind(console),
    error: console.error.bind(console),
    info: console.error.bind(console),
    log: console.log.bind(console),
    warn: console.warn.bind(console)
  },
  baseNamespace: '',
  separator: ':'
}

Overriding Default Value

You can override any of the default value.

var Logger = require('@letumfalx/debug-logger');

var original = new Logger('namespace');
original.info('Log "original"');

// override the baseNamespace
Logger.LoggerConfig.defaults.baseNamespace = 'override';

var logger = new Logger('namespace');
logger.info('Log "overriden"');

Above code will output:

  namespace:info Log "original" +0ms
  override:namespace:info Log "overriden" +0ms