alog

Awesome logger for node.js.

npm install alog
44 downloads in the last month

Alog

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

Install

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

npm install alog

Usage

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');

Options

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`
});

Log levels

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

Specify color

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);

Donations

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

npm loves you