winston-cassandra
Advanced tools
Comparing version 0.1.1 to 0.2.0
10
index.js
@@ -1,6 +0,6 @@ | ||
var util = require('util'); | ||
var util = require('util'); | ||
var events = require('events'); | ||
var winston = require('winston'); | ||
var cql = require('node-cassandra-cql'); | ||
var cql = require('cassandra-driver'); | ||
@@ -67,6 +67,6 @@ var defaultOptions = { | ||
//execute as a prepared query as it would be executed multiple times | ||
return this.client.executeAsPrepared( | ||
return this.client.execute( | ||
'INSERT INTO ' + this.options.table + ' (key, date, level, message, meta) VALUES (?, ?, ?, ?, ?)', | ||
[key, new Date(), level, msg, util.inspect(meta)], | ||
this.options.consistency, | ||
{prepare: true, consistency: this.options.consistency}, | ||
callback); | ||
@@ -142,2 +142,2 @@ }; | ||
module.exports.Cassandra = Cassandra; | ||
module.exports.types = cql.types; | ||
module.exports.types = cql.types; |
{ | ||
"name": "winston-cassandra", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Cassandra transport for winston", | ||
@@ -20,3 +20,3 @@ "author": "Jorge Bay <jorgebaygondra@gmail.com>", | ||
"dependencies": { | ||
"node-cassandra-cql": ">= 0.4.0", | ||
"cassandra-driver": ">= 1.0.3", | ||
"winston": ">= 0.7.2" | ||
@@ -28,7 +28,7 @@ }, | ||
}, | ||
"repository": { | ||
"type" : "git", | ||
"repository": { | ||
"type" : "git", | ||
"url" : "https://github.com/jorgebay/winston-cassandra.git" | ||
}, | ||
"bugs": { | ||
"bugs": { | ||
"url" : "https://github.com/jorgebay/winston-cassandra/issues" | ||
@@ -40,2 +40,2 @@ }, | ||
} | ||
} | ||
} |
# winston-cassandra | ||
A Cassandra transport for [winston](https://github.com/flatiron/winston). | ||
A Cassandra transport for [winston](https://github.com/flatiron/winston) logging library. | ||
@@ -10,2 +10,3 @@ ## Installation | ||
``` | ||
[![Build Status](https://secure.travis-ci.org/jorgebay/winston-cassandra.png)](http://travis-ci.org/jorgebay/winston-cassandra) | ||
@@ -16,17 +17,17 @@ ## Usage | ||
// Add Cassandra transport (it also adds the field `winston.transports.Cassandra`) | ||
// Adds a Cassandra transport (it also adds the field `winston.transports.Cassandra`) | ||
winston.add(require('winston-cassandra'), options); | ||
``` | ||
The Cassandra transport accepts the following options. | ||
The Cassandra transport accepts the following options: | ||
* __level:__ Level of messages that this transport should log. | ||
* __table:__ The name of the Cassandra column family you wish your logs (default: `'logs'`). | ||
* __partitionBy:__ The name of the Cassandra column family you wish your logs. Possible values `'hour'` and `'day'`(Default). | ||
* __level:__ Level of messages that this transport should log (default: `'info'`). | ||
* __table:__ The name of the Cassandra column family you want to store log messages in (default: `'logs'`). | ||
* __partitionBy:__ How you want the logs to be partitioned. Possible values `'hour'` and `'day'`(Default). | ||
* __consistency:__ The consistency of the insert query (default: `quorum`). | ||
In addition to the options: accepted by the [Node.js Cassandra driver](https://github.com/jorgebay/node-cassandra-cql) | ||
[Client][0] | ||
In addition to the options accepted by the [Node.js Cassandra driver](https://github.com/jorgebay/node-cassandra-cql) | ||
[Client][0]. | ||
* __hosts:__ Cluster nodes that will handle the write requests. | ||
* __hosts:__ Cluster nodes that will handle the write requests: | ||
Array of strings containing the hosts, for example `['host1', 'host2']` (required). | ||
@@ -36,3 +37,6 @@ * __keyspace:__ The name of the keyspace that will contain the logs table (required). The keyspace should be already created in the cluster. | ||
## License | ||
Distributed under the [MIT license](https://github.com/jorgebay/winston-cassandra/blob/master/LICENSE.txt). | ||
[0]: https://github.com/jorgebay/node-cassandra-cql#client | ||
[0]: https://github.com/jorgebay/node-cassandra-cql#client |
Sorry, the diff of this file is not supported yet
8411
130
40