A RavenDB transport for [winston][0].
var winston = require('winston');
// Requiring `winston-ravendb` will expose
// `winston.transports.RavenDB`
require('winston-ravendb').RavenDB;
winston.add(winston.transports.RavenDB, options);
###Queries
logger.query({level: "error"}, function(err, results) {
if(err) {
//error handling
}
//do something
});
logger.query({from: "2013-01-01", to: 2013-12-31}, function(err, results) {
if(err) {
//error handling
}
//do something
});
logger.luceneQuery("myQuickIndex", "timestamp:[2013-01-01 TO 2013-04-02] AND level:NULL", function(err, results) {
if(err) {
//error handling
}
//do something
});
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.
$ npm install winston
$ npm install winston-ravendb