alog

Awesome logger for node.js.

Alog

Awesome logger for node.js with colors and stream support.

Awesome logger is available with npm. Install it like so:

npm install alog
var Alog = require('alog');
console  = new Alog();

console.info('Hello World!');
console.warn('The end is near!');
console.error('Flawed logic.');
console.started('Lifting weights');
console.finished('Weight training');

You can specify the stream to write to and an additional stream to fork to, as well as add datestamps to the output.

var Alog   = require('alog');
var logger = new Alog({
  datestamp: true,         // Include ISO 8601 date. Defaults to `false`.
  level: 3,                // Maximum log level to output. Defaults to `3`.
  file: '/tmp/logger.out', // Not set by default.
  fork: Stream,            // Copy output to additional stream. Optional.
  stream: process.stdout   // Defalts to `process.stdout`
});

Set the maximum log level option to restrict which kind of messages are output. The following log levels correspond to a logger method.

0 error
0 failure
1 notice
2 warning
3 created
3 done
3 info
3 finished
3 started
3 stopped
4 debug

Each log level has a color associated with it by default. You can pass your own ANSII color code like so:

log.debug('Hello World', 36);

If you like using alog, tip me some bits @ 1MUaP1e5DcuWrup7nLwK1rBfLR7YCcjnqS