mongo-morgan

This is a morgan module saves logs to mongodb database

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
mongo-morgan
1112.0.35 years ago8 years agoMinified + gzip package size for mongo-morgan in KB

Readme

mongo-morgan
!NPM Versionnpm-imagenpm-url !NPM Downloadsdownloads-imagedownloads-url !Build Statustravis-imagetravis-url
This is build upon morgan module which saves logs to mongodb database

API

var mongoMorgan = require('mongo-morgan')

mongoMorgan(mongodburl, format, options)

Create a new mongo-morgan logger middleware function using the given mongodburl, format and options. The mongodburl is required and is connection string to mongodb The format (same as morgan module) argument may be a string of a predefined name (see below for the names), a string of a format string, or a function that will produce a log entry.

Options

Options is as same as morgan module. Just added collection properties.

collection

Save logs to the given collection in mongodb. defaults to requests.
// EXAMPLE: save logs to logs collection
mongoMorgan('url', 'combined', {
  collection: 'logs'
})

To Do

  • x Save logs as objects.
  • Add documentation for saving logs as objects.

License

MIT