Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 53 lines (37 sloc) 1.806 kB
e6111b4 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
1 # winston
2
3 A MongoDB transport for [winston][0].
4
5 ## Installation
6
7 ### Installing npm (node package manager)
ff96a49 @indexzero [doc] Update README.md
indexzero authored
8
9 ``` bash
10 $ curl http://npmjs.org/install.sh | sh
e6111b4 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
11 ```
12
9949380 @indexzero [doc] Small update to README.md
indexzero authored
13 ### Installing winston-mongodb
ff96a49 @indexzero [doc] Update README.md
indexzero authored
14
15 ``` bash
16 $ npm install winston
17 $ npm install winston-mongodb
e6111b4 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
18 ```
19
20 ## Motivation
21 `tldr;?`: To break the [winston][0] codebase into small modules that work together.
22
23 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.
24
25 ## Usage
26 ``` js
ff96a49 @indexzero [doc] Update README.md
indexzero authored
27 var winston = require('winston');
28
29 //
30 // Requiring `winston-mongodb` will expose
31 // `winston.transports.MongoDB`
32 //
33 require('winston-mongodb').MongoDB;
34
35 winston.add(winston.transports.MongoDB, options);
e6111b4 @indexzero [refactor] Initial commit of refactor from winston core
indexzero authored
36 ```
37
38 The MongoDB transport takes the following options. 'db' is required:
39
40 * __level:__ Level of messages that this transport should log.
41 * __silent:__ Boolean flag indicating whether to suppress output.
42 * __db:__ The name of the database you want to log to. *[required]*
43 * __collection__: The name of the collection you want to store log messages in, defaults to 'log'.
44 * __safe:__ Boolean indicating if you want eventual consistency on your log messages, if set to true it requires an extra round trip to the server to ensure the write was committed, defaults to true.
45 * __host:__ The host running MongoDB, defaults to localhost.
46 * __port:__ The port on the host that MongoDB is running on, defaults to MongoDB's default port.
47
48 *Metadata:* Logged as a native JSON object.
49
50 #### Author: [Charlie Robbins](http://blog.nodejitsu.com)
51 #### Contributors: [Kendrick Taylor](https://github.com/sktaylor)
52
53 [0]: https://github.com/indexzero/winston
Something went wrong with that request. Please try again.