Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Mongo logger for Hubiquitus
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
LICENSE
README.md
index.js
package.json
sample.js

README.md

Hubiquitus logger mongo

This module overrides the log method of hubiquitus to persist logs into database.

Installation

$ npm install hubiquitus-logger-mongo

How to use

var hubiquitus = require('hubiquitus-core');
var mongoLogger = require('hubiquitus-logger-mongo');

var logger = hubiquitus.logger('sample');
hubiquitus.logger.enable('sample', 'info');

mongoLogger.configure({dbname: 'test', collection: 'hlog'}, function (err) {
  if (err) return logger.err(err);
  logger.info('OK !');
});

The configure method takes a configuration object. That object may contains :

  • host {String} mongo host; default is '127.0.0.1'
  • port {Number} mongo port; default is mongo.Connection.DEFAULT_PORT
  • dbname {String} mongo database; default is 'hubiquitus'
  • collection {String} mongo collection; default is 'logs'
  • username {String} mongo username; default does not use authentication
  • password {String} mongo password; default does not use authentication
Something went wrong with that request. Please try again.