0.3.1 • Published 9 years ago

ulogger v0.3.1

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

uLogger

Tiny logger utility for Node.JS and the browser

Usage

var logger = require('ulogger')('my-unit');

logger.log('A message inside my unit');
logger.error('Oops, my unit has an error!');

Enable/disable

In your app code, you can enable/disable the logger at any moment:

var logger = require('ulogger')
logger.enable();

// ...

logger.disable();

On Node.JS, you can start your app with an environment flag:

DEBUG=1 node my-app.js

Same goes for a web app, but in the window object:

window.DEBUG=1;

Log levels

You can adjust the logging level from error to debug. The log whose values are higher than the level won't be printed.

// 0 = error
// 1 = warn
// 2 = info
// 3 = log
// 4 = debug

var level = 2;
logger.logLevel(level);

// only error, warn and info logs will be printed from now on

Happy debugging!

0.3.1

9 years ago

0.3.0

9 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago