winston-ravendb

A RavenDb transport implementation for winston

npm install winston-ravendb
12 downloads in the last month

winston-ravendb

A RavenDB transport for [winston][0].

Usage

  var winston = require('winston');

  // Requiring `winston-ravendb` will expose 
  // `winston.transports.RavenDB`

  require('winston-ravendb').RavenDB;

  winston.add(winston.transports.RavenDB, options);

Queries

Filter by level

logger.query({level: "error"}, function(err, results) {
    if(err) {
        //error handling
    }
    //do something
});

Filter by dates

logger.query({from: "2013-01-01", to: 2013-12-31}, function(err, results) {
    if(err) {
        //error handling
    }
    //do something
});

Filter using lucene

logger.luceneQuery("myQuickIndex", "timestamp:[2013-01-01 TO 2013-04-02] AND level:NULL", function(err, results) {
    if(err) {
        //error handling
    }
    //do something
});

Filter using fluent api

logger.query("myCustomQuickIndex")
    .where("level")
    .is("error")
    .results(function(err, results) {
        if(err) {
            //error handling
        }
        //do something
    });

The RavenDB transport takes the following options:

  • level: Level of messages that this transport should log, defaults to 'info'.
  • entityName: 'Raven-Entity-Name' in RavenDB , defaults to 'Log'.
  • connectionString: The connection string for connecting to RavenDB.
  • database: The name of the database you want to log to.
  • serverUrl: The url where RavenDB is running (required if no connectionString supplied).
  • username: The username for conencting to RavenDB (required if no connectionString supplied and depending on RavenDB authentication).
  • password: The password for conencting to RavenDB (required if no connectionString supplied and depending on RavenDB authentication).
  • apiKey: The apiKey for conencting to RavenDB (required if no connectionString supplied and depending on RavenDB authentication).
  • proxyUrl: Proxy url if needed.

Installation

Installing winston-ravendb

  $ npm install winston
  $ npm install winston-ravendb
npm loves you