Light-weight logging for NodeJS.
$ npm install log
Log level defaults to DEBUG however here we specify INFO, and the stream defaults to stdout:
var Log = require('log')
, log = new Log(Log.INFO);
log.debug('preparing email');
log.info('sending email');
log.error('failed to send email');
Specifying a specific stream:
var fs = require('fs')
, Log = require('log')
, log = new Log(Log.DEBUG, fs.createWriteStream('my.log'));
Instead of the log level constants, you may also supply a string:
var Log = require('log')
, log = new Log('warning');
Mirror that of syslog:
- 0 EMERGENCY system is unusable
- 1 ALERT action must be taken immediately
- 2 CRITICAL the system is in critical condition
- 3 ERROR error condition
- 4 WARNING warning condition
- 5 NOTICE a normal but significant condition
- 6 INFO a purely informational message
- 7 DEBUG messages to debug an application