Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (44 sloc) 1.925 kb
c502494 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
1 # winston-riak
2
3 A Riak transport for [winston][0].
4
5 ## Motivation
6 `tldr;?`: To break the [winston][0] codebase into small modules that work together.
7
8 The [winston][0] codebase has been growing significantly with contributions and other logging transports. This is **awesome**. However, taking a ton of additional dependencies just to do something simple like logging to the Console and a File is overkill.
9
10 ## Usage
11 ``` js
b62a692 @indexzero [doc] Update README.md
indexzero authored
12 var winston = require('winston');
13
14 //
15 // Requiring `winston-riak` will expose
16 // `winston.transports.Riak`
17 //
18 require('winston-riak').Riak;
19
20 winston.add(winston.transports.Riak, options);
c502494 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
21 ```
22
23 In addition to the options accepted by the [riak-js][1] [client][2], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default:
24
25 * __level:__ Level of messages that this transport should log.
26 * __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically.
27
28 ``` js
29 // Use a single bucket for all your logs
b62a692 @indexzero [doc] Update README.md
indexzero authored
30 var singleBucketTransport = new (winston.transports.Riak)({ bucket: 'some-logs-go-here' });
c502494 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
31
32 // Generate a dynamic bucket based on the date and level
b62a692 @indexzero [doc] Update README.md
indexzero authored
33 var dynamicBucketTransport = new (winston.transports.Riak)({
c502494 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
34 bucket: function (level, msg, meta, now) {
35 var d = new Date(now);
36 return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-');
37 }
38 });
39 ```
40
41 *Metadata:* Logged as JSON literal in Riak
42
c0c8bd0 @indexzero [minor] Small updates
indexzero authored
43 ## Installation
44
45 ### Installing npm (node package manager)
46
47 ``` bash
48 $ curl http://npmjs.org/install.sh | sh
49 ```
50
51 ### Installing winston-riak
52
53 ``` bash
54 $ npm install winston
55 $ npm install winston-riak
56 ```
57
c502494 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
58 #### Author: [Charlie Robbins](http://blog.nodejitsu.com)
59
60 [0]: https://github.com/indexzero/winston
61 [1]: http://riakjs.org
62 [2]: https://github.com/frank06/riak-js/blob/master/src/http_client.coffee#L10
Something went wrong with that request. Please try again.