lognj v0.0.5
Simple Logger
How to use
npm install lognj
var doct=require('lognj');
var l=doct.getLogger('filelog','/tmp/log/'); //if you want to log into a file var l=doct.getLogger('dblog','mydb','log'); // log into db...currently only mongodb is supported 'mydb' is database name and 'log' is collection name var l=doct.getLogger('socketlog','16.186.7.38:3000'); and the codes on the other server side should be socket.on('debug', function (data) {console.log(data.data) ;}); socket.on('error', function (data) {console.log(data.data) ;}); socket.on('info', function (data) {console.log(data.data) ;}); socket.on('warn', function (data) {console.log(data.data) ;});
data.data is the log msg you have send through the socket
var l=doc.getLogger(); //do nothing log into command line
it has debug(logmsg) error(logmsg) info(logmsg) warn(logmsg) trunOffDebug() turnOffInfo() turnOffWarnning() methods