/node-plog

Primary LanguageJavaScript

node-plog

Friendly logging for Javascript.

Usage

var plog = require('plog'),
    debug = plog('example');

debug('just like good old debug');
debug('args', ['get', 'expanded']);
debug.error('but you can also have levels');

// You can grab any loggers that have been created
// and change their levels
plog.all().level('debug');

// Or by regex
plog.find(/^example/).level('critical');

// Which comes in handy for tests
plog.all().level('debug').remove('console').file('./plog-example.log');

// And in production
plog.all().level('error').file('./plog.log');

// You can even use the normal env variables
process.env.DEBUG=* === plog.all().level('debug');

It also works in the browser thanks to browserify.

If you're working in chrome, you'll also get colored output in the console.

Color in your console

Install

 npm install plog