![Build Status](https://travis-ci.org/martinj/node-aut.svg)
aut
Simple logging library with filtering using environment variables
Installation
This module is installed via npm:
$ npm install aut
Filtering
By default all output is shown.
Show all name & levels except log2 & warn
LOGLEVELS=*,-warn LOGNAMES=*,-log2 node myapp
Show specific names & levels
LOGLEVELS=error,warn LOGNAMES=log2 node myapp
Colors
Colors is enabled when stdout is a TTY.
Examples
const log = require('aut')();
log('foo bar');
log('foo bar', { a: 'b' });
log.error(new Error('Shit'));
log.debug('hmm %s thats cool', 'wow');
log.warn('oh my');
log.info('aha..');
const log2 = require('aut')('log2');
log2('foo bar');
log2('foo bar', { a: 'b' });
log2.error(new Error('Shit'));
log2.debug('hmm %s thats cool', 'wow');
log2.warn('oh my');
log2.info('aha..');
const log3 = require('aut')('custom', {
date: function () { return 'My Custom Date'; },
write: function (msg) { console.log(msg); },
levels: ['mega', 'alpha'],
format: function (data) {
return Object.keys(data).map(function (k) {
return k + ': ' + data[k];
}).join(', ');
}
});
log3('foo bar');
log3('foo bar', { a: 'b' });
log3.mega(new Error('Shit'));
log3.alpha('hmm');