0.4.4 • Published 13 years ago
basic-logger v0.4.4
logger
Basic logger for nodejs supporting error, warning, debug and info messages with timestamp. Everything you log is printed to the console.
Installation
npm install loggerUsage
var logger = require('logger');
var customConfig = {
showMillis: true;
stringifyJSON: false;
};
var log = new logger(customConfig)
log.info('New Info!');
log.error('An error occurred');
log.warn('I am not kidding!');
log.debug('this code is still alive...');Config options
showMillis- Show the milliseconds in the timestampstringifyJSON- Apply JSON.stringify to the given message. Good to log objects or arrays.
Test
You'll need vows. Then just run npm test.
Future versions
I am willing to add support for colored log messages and allow to define a prefix which is prepended to all messages.