Log.jsTiny logger for NodeJS. | |
| lib/log.js |
Initialize a Loggeer with the given log level defaulting
to DEBUG and stream defaulting to stdout.
param: Number level param: Object stream api: public
|
var Log = exports = module.exports = function Log(level, stream){
this.level = level || exports.DEBUG;
this.stream = stream || process.stdout;
};
|
System is unusable.
|
exports.EMERGENCY = 0;
|
Action must be taken immediately.
|
exports.ALERT = 1;
|
Critical condition.
|
exports.CRITICAL = 2;
|
Error condition.
|
exports.ERROR = 3;
|
Warning condition.
|
exports.WARNING = 4;
|
Normal but significant condition.
|
exports.NOTICE = 5;
|
Purely informational message.
|
exports.INFO = 6;
|
Application debug messages.
|
exports.DEBUG = 7;
|
prototype.
|
Log.prototype = {
|
Log emergency msg .
param: String msg api: public
|
emergency: function(msg){
this.log('EMERGENCY', msg);
},
|
Log alert msg .
param: String msg api: public
|
alert: function(msg){
this.log('ALERT', msg);
},
|
Log critical msg .
param: String msg api: public
|
critical: function(msg){
this.log('CRITICAL', msg);
},
|
Log error msg .
param: String msg api: public
|
error: function(msg){
this.log('ERROR', msg);
},
|
Log warning msg .
param: String msg api: public
|
warning: function(msg){
this.log('WARNING', msg);
},
|
Log notice msg .
param: String msg api: public
|
notice: function(msg){
this.log('NOTICE', msg);
},
|
Log info msg .
param: String msg api: public
|
info: function(msg){
this.log('INFO', msg);
},
|
Log debug msg .
param: String msg api: public
|
debug: function(msg){
this.log('DEBUG', msg);
}
};
|