node package manager


Simple Logging using MongoDB


Simple logging for Node using MongoDB.

$ npm install logmongo

Add the following to your main script and specify your login details for the Admin.

var logger = require('logmongo');
logger.log('login', 1);

If your App already connects to Mongo then you can use the same Database and miss out the connect call.

To display existing logs:

var util = require('util'), log = require('logmongo.js');
log.forAll(function(error, row) {
    util.log('ROW: ' + util.inspect(row));
}, function(error) {
    if (error) throw error;
    util.log('ALL DONE');
    log.disconnect(function(err) { });