Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 795 lines (621 sloc) 26.892 kb
eb83080 @Marak [docs] Updating travis image in README
Marak authored
1 # winston [![Build Status](https://secure.travis-ci.org/flatiron/winston.png?branch=master)](http://travis-ci.org/flatiron/winston)
917737a @indexzero [doc dist api] Initial commit ... no tests since I have no internet
indexzero authored
2
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
3 A multi-transport async logging library for node.js. <span style="font-size:28px; font-weight:bold;">&quot;CHILL WINSTON! ... I put it in the logs.&quot;</span>
917737a @indexzero [doc dist api] Initial commit ... no tests since I have no internet
indexzero authored
4
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
5 ## Motivation
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
6 Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file.
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
7
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
8 There also seemed to be a lot of logging libraries out there that coupled their implementation of logging (i.e. how the logs are stored / indexed) to the API that they exposed to the programmer. This library aims to decouple those parts of the process to make it more flexible and extensible.
64b82cb @indexzero [doc api] Added to README.md. Started file transport.
indexzero authored
9
3ce7541 @indexzero [doc] More README.md changes
indexzero authored
10 ## Usage
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
11 There are two different ways to use winston: directly via the default logger, or by instantiating your own Logger. The former is merely intended to be a convenient shared logger to use throughout your application if you so choose.
3ce7541 @indexzero [doc] More README.md changes
indexzero authored
12
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
13 * [Logging](#logging)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
14 * [Using the Default Logger](#using-the-default-logger)
15 * [Instantiating your own Logger](#instantiating-your-own-logger)
16 * [Logging with Metadata](#logging-with-metadata)
c157e14 @indexzero [fix doc] Update link to Transports documentation to be in `master`
indexzero authored
17 * [Transports](https://github.com/flatiron/winston/blob/master/docs/transports.md)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
18 * [Profiling](#profiling)
19 * [Streaming Logs](#streaming-logs)
20 * [Querying Logs](#querying-logs)
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
21 * [Exceptions](#exceptions)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
22 * [Handling Uncaught Exceptions with winston](#handling-uncaught-exceptions-with-winston)
23 * [To Exit or Not to Exit](#to-exit-or-not-to-exit)
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
24 * [Logging Levels](#logging-levels)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
25 * [Using Logging Levels](#using-logging-levels)
26 * [Using Custom Logging Levels](#using-custom-logging-levels)
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
27 * [Further Reading](#further-reading)
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
28 * [Events and Callbacks in Winston](#events-and-callbacks-in-winston)
29 * [Working with multiple Loggers in winston](#working-with-multiple-loggers-in-winston)
30 * [Using winston in a CLI tool](#using-winston-in-a-cli-tool)
31 * [Extending another object with Logging](#extending-another-object-with-logging)
6095828 Adding last sections to the table of contents
tUrG0n authored
32 * [Working with transports](#working-with-transports)
33 * [Adding Custom Transports](#adding-custom-transports)
34 * [Installation](#installation)
35 * [Run Tests](#run-tests)
36
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
37
38 ## Logging
3ce7541 @indexzero [doc] More README.md changes
indexzero authored
39
40 ### Using the Default Logger
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
41 The default logger is accessible through the winston module directly. Any method that you could call on an instance of a logger is available on the default logger:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
42
43 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
44 var winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
45
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
46 winston.log('info', 'Hello distributed log files!');
47 winston.info('Hello again distributed logs');
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
48 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
49
50 By default, only the Console transport is set on the default logger. You can add or remove transports via the add() and remove() methods:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
51
52 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
53 winston.add(winston.transports.File, { filename: 'somefile.log' });
54 winston.remove(winston.transports.Console);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
55 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
56
f666df1 Adding reference to 'Working with transports' section
tUrG0n authored
57 For more documenation about working with each individual transport supported by Winston see the [Working with transports](#working-with-transports) section below.
3ce7541 @indexzero [doc] More README.md changes
indexzero authored
58
59 ### Instantiating your own Logger
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
60 If you would prefer to manage the object lifetime of loggers you are free to instantiate them yourself:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
61
62 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
63 var logger = new (winston.Logger)({
64 transports: [
65 new (winston.transports.Console)(),
66 new (winston.transports.File)({ filename: 'somefile.log' })
67 ]
68 });
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
69 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
70
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
71 You can work with this logger in the same way that you work with the default logger:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
72
73 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
74 //
75 // Logging
76 //
77 logger.log('info', 'Hello distributed log files!');
78 logger.info('Hello again distributed logs');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
79
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
80 //
81 // Adding / Removing Transports
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
82 // (Yes It's chainable)
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
83 //
3f98022 @indexzero [doc] Updated README.md removing Riak transport
indexzero authored
84 logger.add(winston.transports.File)
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
85 .remove(winston.transports.Console);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
86 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
87
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
88 ### Logging with Metadata
89 In addition to logging string messages, winston will also optionally log additional JSON metadata objects. Adding metadata is simple:
90
91 ``` js
92 winston.log('info', 'Test Log Message', { anything: 'This is metadata' });
93 ```
94
95 The way these objects is stored varies from transport to transport (to best support the storage mechanisms offered). Here's a quick summary of how each transports handles metadata:
96
97 1. __Console:__ Logged via util.inspect(meta)
98 2. __File:__ Logged via util.inspect(meta)
99
100 ## Profiling
101 In addition to logging messages and metadata, winston also has a simple profiling mechanism implemented for any logger:
102
103 ``` js
104 //
105 // Start profile of 'test'
106 // Remark: Consider using Date.now() with async operations
107 //
108 winston.profile('test');
109
110 setTimeout(function () {
111 //
112 // Stop profile of 'test'. Logging will now take place:
113 // "17 Jan 21:00:00 - info: test duration=1000ms"
114 //
115 winston.profile('test');
116 }, 1000);
117 ```
118
119 All profile messages are set to the 'info' by default and both message and metadata are optional There are no plans in the Roadmap to make this configurable, but I'm open to suggestions / issues.
120
121
122 ## Querying Logs
123 Winston supports querying of logs with Loggly-like options.
124 Specifically: `File`, `Couchdb`, `Redis`, `Loggly`, `Nssocket`, and `Http`.
125
126 ``` js
127 var options = {
128 from: new Date - 24 * 60 * 60 * 1000,
129 until: new Date
130 };
131
132 //
133 // Find items logged between today and yesterday.
134 //
135 winston.query(options, function (err, results) {
136 if (err) {
137 throw err;
138 }
139
140 console.log(results);
141 });
142 ```
143
144 ## Streaming Logs
145 Streaming allows you to stream your logs back from your chosen transport.
146
147 ``` js
148 //
149 // Start at the end.
150 //
151 winston.stream({ start: -1 }).on('log', function(log) {
152 console.log(log);
153 });
154 ```
155
156 ## Exceptions
157
8609730 @indexzero [doc] Updated README.md
indexzero authored
158 ### Handling Uncaught Exceptions with winston
159
160 With `winston`, it is possible to catch and log `uncaughtException` events from your process. There are two distinct ways of enabling this functionality either through the default winston logger or your own logger instance.
161
162 If you want to use this feature with the default logger simply call `.handleExceptions()` with a transport instance.
163
164 ``` js
165 //
166 // You can add a separate exception logger by passing it to `.handleExceptions`
167 //
168 winston.handleExceptions(new winston.transports.File({ filename: 'path/to/exceptions.log' }))
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
169
8609730 @indexzero [doc] Updated README.md
indexzero authored
170 //
171 // Alternatively you can set `.handleExceptions` to true when adding transports to winston
172 //
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
173 winston.add(winston.transports.File, {
174 filename: 'path/to/all-logs.log',
175 handleExceptions: true
8609730 @indexzero [doc] Updated README.md
indexzero authored
176 });
177 ```
178
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
179 ### To Exit or Not to Exit
45c5707 @dominictarr [docs] set whether to exitOnError
dominictarr authored
180
181 by default, winston will exit after logging an uncaughtException. if this is not the behavior you want,
182 set `exitOnError = false`
183
184 ``` js
5d1acae @indexzero [doc] Update README.md with new `exitOnError` functionality
indexzero authored
185 var logger = new (winston.Logger)({ exitOnError: false });
45c5707 @dominictarr [docs] set whether to exitOnError
dominictarr authored
186
5d1acae @indexzero [doc] Update README.md with new `exitOnError` functionality
indexzero authored
187 //
188 // or, like this:
189 //
190 logger.exitOnError = false;
45c5707 @dominictarr [docs] set whether to exitOnError
dominictarr authored
191 ```
192
8609730 @indexzero [doc] Updated README.md
indexzero authored
193 When working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport.
194
4d050a5 @ubun2 Add example for showing exception handling
ubun2 authored
195 Example 1
196
8609730 @indexzero [doc] Updated README.md
indexzero authored
197 ``` js
198 var logger = new (winston.Logger)({
199 transports: [
200 new winston.transports.File({ filename: 'path/to/all-logs.log' })
201 ]
202 exceptionHandlers: [
203 new winston.transports.File({ filename: 'path/to/exceptions.log' })
204 ]
205 });
206 ```
207
4d050a5 @ubun2 Add example for showing exception handling
ubun2 authored
208 Example 2
209
210 ```
211 var logger = new winston.Logger({
212 transports: [
213 new winston.transports.Console({
214 handleExceptions: true,
215 json: true
216 })
217 ],
218 exitOnError: false
219 });
220 ```
221
5d1acae @indexzero [doc] Update README.md with new `exitOnError` functionality
indexzero authored
222 The `exitOnError` option can also be a function to prevent exit on only certain types of errors:
223
224 ``` js
225 function ignoreEpipe(err) {
226 return err.code !== 'EPIPE';
227 }
228
229 var logger = new (winston.Logger)({ exitOnError: ignoreEpipe });
230
231 //
232 // or, like this:
233 //
234 logger.exitOnError = ignoreEpipe;
235 ```
236
6c5d42d @indexzero [doc] Minor formatting fixes in README.md
indexzero authored
237 ## Logging Levels
238
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
239 ### Using Logging Levels
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
240 Setting the level for your logging message can be accomplished in one of two ways. You can pass a string representing the logging level to the log() method or use the level specified methods defined on every winston Logger.
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
241
242 ``` js
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
243 //
244 // Any logger instance
245 //
d4e9b44 @danilopopeye Fixed the broken ' in log
danilopopeye authored
246 logger.log('info', "127.0.0.1 - there's no place like home");
27ca3f8 @ubun2 Clarify how to log different levels
ubun2 authored
247 logger.log('warn', "127.0.0.1 - there's no place like home");
248 logger.log('error', "127.0.0.1 - there's no place like home");
d4e9b44 @danilopopeye Fixed the broken ' in log
danilopopeye authored
249 logger.info("127.0.0.1 - there's no place like home");
27ca3f8 @ubun2 Clarify how to log different levels
ubun2 authored
250 logger.warn("127.0.0.1 - there's no place like home");
251 logger.error("127.0.0.1 - there's no place like home");
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
252
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
253 //
254 // Default logger
255 //
d4e9b44 @danilopopeye Fixed the broken ' in log
danilopopeye authored
256 winston.log('info', "127.0.0.1 - there's no place like home");
257 winston.info("127.0.0.1 - there's no place like home");
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
258 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
259
16dc3a9 @coderarity [doc] Add example of logging to a transport with the `level` option.
coderarity authored
260 Winston allows you to set a `level` on each transport that specifies the level of messages this transport should log. For example, you could log only errors to the console, with the full logs in a file:
261
262 ``` js
263 var logger = new (winston.Logger)({
264 transports: [
265 new (winston.transports.Console)({ level: 'error' }),
266 new (winston.transports.File)({ filename: 'somefile.log' })
267 ]
268 });
269 ```
270
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
271 As of 0.2.0, winston supports customizable logging levels, defaulting to [npm][0] style logging levels. Changing logging levels is easy:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
272
273 ``` js
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
274 //
275 // Change levels on the default winston logger
276 //
277 winston.setLevels(winston.config.syslog.levels);
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
278
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
279 //
280 // Change levels on an instance of a logger
281 //
282 logger.setLevels(winston.config.syslog.levels);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
283 ```
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
284
285 Calling `.setLevels` on a logger will remove all of the previous helper methods for the old levels and define helper methods for the new levels. Thus, you should be careful about the logging statements you use when changing levels. For example, if you ran this code after changing to the syslog levels:
286
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
287 ``` js
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
288 //
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
289 // Logger does not have 'silly' defined since that level is not in the syslog levels
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
290 //
291 logger.silly('some silly message');
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
292 ```
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
293
294 ### Using Custom Logging Levels
295 In addition to the predefined `npm` and `syslog` levels available in Winston, you can also choose to define your own:
296
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
297 ``` js
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
298 var myCustomLevels = {
299 levels: {
300 foo: 0,
301 bar: 1,
302 baz: 2,
303 foobar: 3
304 },
305 colors: {
306 foo: 'blue',
307 bar: 'green',
308 baz: 'yellow',
309 foobar: 'red'
310 }
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
311 };
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
312
313 var customLevelLogger = new (winston.Logger)({ levels: myCustomLevels.levels });
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
314 customLevelLogger.foobar('some foobar level-ed message');
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
315 ```
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
316
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
317 Although there is slight repetition in this data structure, it enables simple encapsulation if you not to have colors. If you do wish to have colors, in addition to passing the levels to the Logger itself, you must make winston aware of them:
318
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
319 ``` js
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
320 //
321 // Make winston aware of these colors
322 //
323 winston.addColors(myCustomLevels.colors);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
324 ```
ab0ec56 @indexzero [doc minor] Expose winston.addColors(). Update docs for custom levels
indexzero authored
325
326 This enables transports with the 'colorize' option set to appropriately color the output of custom levels.
327
d78fd52 @indexzero [doc] Continued refactor of README.md
indexzero authored
328 ## Further Reading
329
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
330 ### Events and Callbacks in Winston
331 Each instance of winston.Logger is also an instance of an [EventEmitter][1]. A log event will be raised each time a transport successfully logs a message:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
332
333 ``` js
184c3bd @indexzero [doc] Fix typo in README.md. Fixes #57
indexzero authored
334 logger.on('logging', function (transport, level, msg, meta) {
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
335 // [msg] and [meta] have now been logged at [level] to [transport]
336 });
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
337
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
338 logger.info('CHILL WINSTON!', { seriously: true });
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
339 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
340
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
341 It is also worth mentioning that the logger also emits an 'error' event which you should handle or suppress if you don't want unhandled exceptions:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
342
343 ``` js
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
344 //
345 // Handle errors
346 //
347 logger.on('error', function (err) { /* Do Something */ });
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
348
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
349 //
350 // Or just suppress them.
351 //
352 logger.emitErrs = false;
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
353 ```
47a5bee @indexzero [dist doc] Version bump. Small updates to README.md for 0.1.0.
indexzero authored
354
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
355 Every logging method described in the previous section also takes an optional callback which will be called only when all of the transports have logged the specified message.
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
356
357 ``` js
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
358 logger.info('CHILL WINSTON!', { seriously: true }, function (err, level, msg, meta) {
359 // [msg] and [meta] have now been logged at [level] to **every** transport.
360 });
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
361 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
362
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
363 ### Working with multiple Loggers in winston
364
365 Often in larger, more complex applications it is necessary to have multiple logger instances with different settings. Each logger is responsible for a different feature area (or category). This is exposed in `winston` in two ways: through `winston.loggers` and instances of `winston.Container`. In fact, `winston.loggers` is just a predefined instance of `winston.Container`:
366
367 ``` js
368 var winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
369
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
370 //
371 // Configure the logger for `category1`
372 //
373 winston.loggers.add('category1', {
374 console: {
375 level: 'silly',
376 colorize: 'true'
377 },
378 file: {
379 filename: '/path/to/some/file'
380 }
381 });
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
382
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
383 //
384 // Configure the logger for `category2`
385 //
386 winston.loggers.add('category2', {
387 couchdb: {
388 host: '127.0.0.1',
389 port: 5984
390 }
391 });
392 ```
393
394 Now that your loggers are setup you can require winston _in any file in your application_ and access these pre-configured loggers:
395
396 ``` js
397 var winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
398
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
399 //
400 // Grab your preconfigured logger
401 //
402 var category1 = winston.loggers.get('category1');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
403
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
404 category1.info('logging from your IoC container-based logger');
405 ```
406
407 If you prefer to manage the `Container` yourself you can simply instantiate one:
408
409 ``` js
410 var winston = require('winston'),
411 container = new winston.Container();
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
412
09926b3 @indexzero [doc] Updated README.md for `winston.loggers`
indexzero authored
413 container.add('category1', {
414 console: {
415 level: 'silly',
416 colorize: 'true'
417 },
418 file: {
419 filename: '/path/to/some/file'
420 }
421 });
422 ```
423
fa65f54 @indexzero [doc] Updated README.md with docs about sharing transports in winston.Co...
indexzero authored
424 ### Sharing transports between Loggers in winston
425
426 ``` js
427 var winston = require('winston');
428
429 //
430 // Setup transports to be shared across all loggers
431 // in three ways:
432 //
433 // 1. By setting it on the default Container
434 // 2. By passing `transports` into the constructor function of winston.Container
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
435 // 3. By passing `transports` into the `.get()` or `.add()` methods
fa65f54 @indexzero [doc] Updated README.md with docs about sharing transports in winston.Co...
indexzero authored
436 //
437
438 //
439 // 1. By setting it on the default Container
440 //
441 winston.loggers.options.transports = [
442 // Setup your shared transports here
443 ];
444
445 //
446 // 2. By passing `transports` into the constructor function of winston.Container
447 //
448 var container = new winston.Container({
449 transports: [
450 // Setup your shared transports here
451 ]
452 });
453
454 //
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
455 // 3. By passing `transports` into the `.get()` or `.add()` methods
456 //
fa65f54 @indexzero [doc] Updated README.md with docs about sharing transports in winston.Co...
indexzero authored
457 winston.loggers.add('some-category', {
458 transports: [
459 // Setup your shared transports here
460 ]
461 });
462
463 container.add('some-category', {
464 transports: [
465 // Setup your shared transports here
466 ]
467 });
468 ```
469
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
470 ### Using winston in a CLI tool
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
471 A common use-case for logging is output to a CLI tool. Winston has a special helper method which will pretty print output from your CLI tool. Here's an example from the [require-analyzer][2] written by [Nodejitsu][3]:
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
472
473 ```
474 info: require-analyzer starting in /Users/Charlie/Nodejitsu/require-analyzer
475 info: Found existing dependencies
476 data: {
477 data: colors: '0.x.x',
478 data: eyes: '0.1.x',
479 data: findit: '0.0.x',
480 data: npm: '1.0.x',
481 data: optimist: '0.2.x',
482 data: semver: '1.0.x',
483 data: winston: '0.2.x'
484 data: }
485 info: Analyzing dependencies...
486 info: Done analyzing raw dependencies
487 info: Retrieved packages from npm
488 warn: No additional dependencies found
489 ```
490
491 Configuring output for this style is easy, just use the `.cli()` method on `winston` or an instance of `winston.Logger`:
492
493 ``` js
494 var winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
495
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
496 //
497 // Configure CLI output on the default logger
498 //
499 winston.cli();
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
500
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
501 //
502 // Configure CLI on an instance of winston.Logger
503 //
504 var logger = new winston.Logger({
505 transports: [
506 new (winston.transports.Console)()
507 ]
508 });
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
509
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
510 logger.cli();
511 ```
512
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and indexabl...
indexzero authored
513 ### Extending another object with Logging
f666df1 Adding reference to 'Working with transports' section
tUrG0n authored
514 Often in a given code base with lots of Loggers it is useful to add logging methods to a different object so that these methods can be called with less syntax. Winston exposes this functionality via the 'extend' method:
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
515
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
516 ``` js
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
517 var myObject = {};
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
518
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
519 logger.extend(myObject);
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
520
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
521 //
522 // You can now call logger methods on 'myObject'
523 //
524 myObject.info('127.0.0.1 - there's no place like home');
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
525 ```
27d0819 @indexzero [api test] Added Logger.extend() and winston.extend() methods
indexzero authored
526
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
527 ## Working with Transports
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
528 Right now there are four transports supported by winston core. If you have a transport you would like to add either open an issue or fork and submit a pull request. Commits are welcome, but I'll give you extra street cred if you __add tests too :D__
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
529
530 1. __Console:__ Output to the terminal
531 2. __Files:__ Append to a file
3f98022 @indexzero [doc] Updated README.md removing Riak transport
indexzero authored
532 3. __Loggly:__ Log to Logging-as-a-Service platform Loggly
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
533
534 ### Console Transport
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
535 ``` js
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
536 winston.add(winston.transports.Console, options)
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
537 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
538
539 The Console transport takes two simple options:
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
540
19a2899 @coderarity [doc] Correct default `Console` level
coderarity authored
541 * __level:__ Level of messages that this transport should log (default 'info').
f4609e6 @SeanBannister Fixing documentation silent defaults to false.
SeanBannister authored
542 * __silent:__ Boolean flag indicating whether to suppress output (default false).
0b1b18f @jfhbrook [doc] Document the "timestamp" option for the console transport
jfhbrook authored
543 * __colorize:__ Boolean flag indicating if we should colorize output (default false).
c50779a @iizukanao [doc] timestamp option accepts a function
iizukanao authored
544 * __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps.
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
545
546 *Metadata:* Logged via util.inspect(meta);
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
547
548 ### File Transport
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
549 ``` js
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
550 winston.add(winston.transports.File, options)
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
551 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
552
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
553 The File transport should really be the 'Stream' transport since it will accept any [WritableStream][14]. It is named such because it will also accept filenames via the 'filename' option:
554
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
555 * __level:__ Level of messages that this transport should log.
556 * __silent:__ Boolean flag indicating whether to suppress output.
072b2d9 @indexzero [doc] Improve docs for 0.1.1 release
indexzero authored
557 * __colorize:__ Boolean flag indicating if we should colorize output.
ed8d7bb @ubun2 timestamp default should be true for file transport in README.md
ubun2 authored
558 * __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default true). If function is specified, its return value will be used instead of timestamps.
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
559 * __filename:__ The filename of the logfile to write output to.
003dba5 [doc] added documentation for the maxsize and maxFiles options in File t...
cronopio authored
560 * __maxsize:__ Max size in bytes of the logfile, if the size is exceeded then a new file is created.
561 * __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded.
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
562 * __stream:__ The WriteableStream to write output to.
d60051d @iizukanao Adding doc about `timestamp` and `json` options for File Transport
iizukanao authored
563 * __json:__ If true, messages will be logged as JSON (default true).
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
564
565 *Metadata:* Logged via util.inspect(meta);
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
566
567 ### Loggly Transport
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
568 ``` js
4db4399 @ubun2 Clarify that Loggly is a separate module like Riak and the others.
ubun2 authored
569 var Loggly = require('winston-loggly').Loggly
570 winston.add(Loggly, options);
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
571 ```
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
572
573 The Loggly transport is based on [Nodejitsu's][5] [node-loggly][6] implementation of the [Loggly][7] API. If you haven't heard of Loggly before, you should probably read their [value proposition][8]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required:
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
574
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
575 * __level:__ Level of messages that this transport should log.
576 * __subdomain:__ The subdomain of your Loggly account. *[required]*
577 * __auth__: The authentication information for your Loggly account. *[required with inputName]*
578 * __inputName:__ The name of the input this instance should log to.
579 * __inputToken:__ The input token of the input this instance should log to.
f6d4d64 @indexzero [api doc] Update Loggly transport to support JSON logging. Update README...
indexzero authored
580 * __json:__ If true, messages will be sent to Loggly as JSON.
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
581
582 *Metadata:* Logged in suggested [Loggly format][2]
64b82cb @indexzero [doc api] Added to README.md. Started file transport.
indexzero authored
583
1e38fd0 @indexzero [refactor] Refactor Riak transport into winston-riak
indexzero authored
584 ### Riak Transport
585 As of `0.3.0` the Riak transport has been broken out into a new module: [winston-riak][17]. Using it is just as easy:
586
587 ``` js
588 var Riak = require('winston-riak').Riak;
589 winston.add(Riak, options);
590 ```
591
592 In addition to the options accepted by the [riak-js][3] [client][4], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default:
593
594 * __level:__ Level of messages that this transport should log.
595 * __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically.
596
597 ``` js
598 // Use a single bucket for all your logs
599 var singleBucketTransport = new (Riak)({ bucket: 'some-logs-go-here' });
600
601 // Generate a dynamic bucket based on the date and level
602 var dynamicBucketTransport = new (Riak)({
603 bucket: function (level, msg, meta, now) {
604 var d = new Date(now);
605 return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-');
606 }
607 });
608 ```
609
610 *Metadata:* Logged as JSON literal in Riak
611
24f12fe @sktaylor Updated documentation to reflect new MongoDB transport, also dropped col...
sktaylor authored
612 ### MongoDB Transport
d77f61b @indexzero [refactor] Refactor MongoDB trasnport into winston-mongodb
indexzero authored
613 As of `0.3.0` the MongoDB transport has been broken out into a new module: [winston-mongodb][16]. Using it is just as easy:
614
24f12fe @sktaylor Updated documentation to reflect new MongoDB transport, also dropped col...
sktaylor authored
615 ``` js
3afac7c @indexzero [doc] Update README.md for `winston-mongodb`. Fixes #35
indexzero authored
616 var MongoDB = require('winston-mongodb').MongoDB;
d77f61b @indexzero [refactor] Refactor MongoDB trasnport into winston-mongodb
indexzero authored
617 winston.add(MongoDB, options);
24f12fe @sktaylor Updated documentation to reflect new MongoDB transport, also dropped col...
sktaylor authored
618 ```
619
620 The MongoDB transport takes the following options. 'db' is required:
621
622 * __level:__ Level of messages that this transport should log.
623 * __silent:__ Boolean flag indicating whether to suppress output.
624 * __db:__ The name of the database you want to log to. *[required]*
625 * __collection__: The name of the collection you want to store log messages in, defaults to 'log'.
0de8d0a @sktaylor Added safe flag to options, for eventual consistency of log messages, up...
sktaylor authored
626 * __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.
24f12fe @sktaylor Updated documentation to reflect new MongoDB transport, also dropped col...
sktaylor authored
627 * __host:__ The host running MongoDB, defaults to localhost.
628 * __port:__ The port on the host that MongoDB is running on, defaults to MongoDB's default port.
629
630 *Metadata:* Logged as a native JSON object.
631
b45d546 @chilts [doc] Add docs for the winston-simpledb transport
chilts authored
632 ### SimpleDB Transport
633
634 The [winston-simpledb][18] transport is just as easy:
635
636 ``` js
637 var SimpleDB = require('winston-simpledb').SimpleDB;
0d6787f Fixed a copy-paste error in README.md.
Jaakko Nissi authored
638 winston.add(SimpleDB, options);
b45d546 @chilts [doc] Add docs for the winston-simpledb transport
chilts authored
639 ```
640
641 The SimpleDB transport takes the following options. All items marked with an asterisk are required:
642
643 * __awsAccessKey__:* your AWS Access Key
644 * __secretAccessKey__:* your AWS Secret Access Key
645 * __awsAccountId__:* your AWS Account Id
646 * __domainName__:* a string or function that returns the domain name to log to
647 * __region__:* the region your domain resides in
648 * __itemName__: a string ('uuid', 'epoch', 'timestamp') or function that returns the item name to log
649
650 *Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.
651
d75e849 @wavded Docs for winston-mail transport.
wavded authored
652 ### Mail Transport
653
654 The [winston-mail][19] is an email transport:
655
656 ``` js
fe43db9 @wavded Error in winston-mail documentation, had a reference to winston-simpledb
wavded authored
657 var Mail = require('winston-mail').Mail;
d75e849 @wavded Docs for winston-mail transport.
wavded authored
658 winston.add(Mail, options);
659 ```
660
6df0bed @wavded updated; mail transport readme
wavded authored
661 The Mail transport uses [emailjs](https://github.com/eleith/emailjs) behind the scenes. Options are the following:
d75e849 @wavded Docs for winston-mail transport.
wavded authored
662
663 * __to:__ The address(es) you want to send to. *[required]*
664 * __from:__ The address you want to send from. (default: `winston@[server-host-name]`)
6df0bed @wavded updated; mail transport readme
wavded authored
665 * __host:__ SMTP server hostname (default: localhost)
d75e849 @wavded Docs for winston-mail transport.
wavded authored
666 * __port:__ SMTP port (default: 587 or 25)
667 * __username__ User for server auth
668 * __password__ Password for server auth
6df0bed @wavded updated; mail transport readme
wavded authored
669 * __ssl:__ Use SSL (boolean or object { key, ca, cert })
670 * __tls:__ Boolean (if true, use starttls)
d75e849 @wavded Docs for winston-mail transport.
wavded authored
671 * __level:__ Level of messages that this transport should log.
672 * __silent:__ Boolean flag indicating whether to suppress output.
673
674 *Metadata:* Stringified as JSON in email.
675
1f1b0a9 @jesseditson adding README entry for winston-sns transport
jesseditson authored
676 ### Amazon SNS (Simple Notification System) Transport
677
678 The [winston-sns][21] transport uses amazon SNS to send emails, texts, or a bunch of other notifications.
679
680 ``` js
681 require('winston-sns').SNS;
682 winston.add(winston.transports.SNS, options);
683 ```
684
685 Options:
686
687 * __aws_key:__ Your Amazon Web Services Key. *[required]*
688 * __aws_secret:__ Your Amazon Web Services Secret. *[required]*
689 * __subscriber:__ Subscriber number - found in your SNS AWS Console, after clicking on a topic. Same as AWS Account ID. *[required]*
690 * __topic_arn:__ Also found in SNS AWS Console - listed under a topic as Topic ARN. *[required]*
691 * __region:__ AWS Region to use. Can be one of: `us-east-1`,`us-west-1`,`eu-west-1`,`ap-southeast-1`,`ap-northeast-1`,`us-gov-west-1`,`sa-east-1`. (default: `us-east-1`)
692 * __subject:__ Subject for notifications. (default: "Winston Error Report")
693 * __message:__ Message of notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Level '%l' Error:\n%e\n\nMetadata:\n%m")
694 * __level:__ lowest level this transport will log. (default: `info`)
695
671f260 @smithclay added note to readme about the graylog2 transport
smithclay authored
696 ### Graylog2 Transport
697
698 [winston-graylog2][22] is a Graylog2 transport:
699
700 ``` js
701 var Graylog2 = require('winston-graylog2').Graylog2;
702 winston.add(Graylog2, options);
703 ```
704
705 The Graylog2 transport connects to a Graylog2 server over UDP using the following options:
706
707 * __level:__ Level of messages this transport should log. (default: info)
708 * __silent:__ Boolean flag indicating whether to suppress output. (default: false)
709
710 * __graylogHost:__ IP address or hostname of the graylog2 server. (default: localhost)
711 * __graylogPort:__ Port to send messages to on the graylog2 server. (default: 12201)
712 * __graylogHostname:__ The hostname associated with graylog2 messages. (default: require('os').hostname())
713 * __graylogFacility:__ The graylog2 facility to send log messages.. (default: nodejs)
714
715 *Metadata:* Stringified as JSON in the full message GELF field.
716
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
717 ### Adding Custom Transports
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
718 Adding a custom transport (say for one of the datastore on the Roadmap) is actually pretty easy. All you need to do is accept a couple of options, set a name, implement a log() method, and add it to the set of transports exposed by winston.
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
719
720 ``` js
8162c4a @indexzero [api doc] Added base Transport object which all other transports derive ...
indexzero authored
721 var util = require('util'),
722 winston = require('winston');
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
723
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
724 var CustomLogger = winston.transports.CustomerLogger = function (options) {
725 //
726 // Name this logger
727 //
728 this.name = 'customLogger';
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
729
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
730 //
731 // Set the level from your options
732 //
733 this.level = options.level || 'info';
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
734
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
735 //
736 // Configure your storage backing as you see fit
737 //
738 };
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
739
8162c4a @indexzero [api doc] Added base Transport object which all other transports derive ...
indexzero authored
740 //
741 // Inherit from `winston.Transport` so you can take advantage
742 // of the base functionality and `.handleExceptions()`.
743 //
744 util.inherits(CustomLogger, winston.Transport);
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
745
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
746 CustomLogger.prototype.log = function (level, msg, meta, callback) {
747 //
748 // Store this message and metadata, maybe use some custom logic
749 // then callback indicating success.
750 //
2ae0eec @chjj [minor] clean whitespace from readme.
chjj authored
751 callback(null, true);
2e44fc8 @indexzero [doc] Finished first draft of documentation for 0.1.0
indexzero authored
752 };
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
753 ```
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
754
f7be1fb @indexzero [doc api] More changes to README.md. Return from wrapped defaultLogger m...
indexzero authored
755 ### Inspirations
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
756 1. [npm][0]
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
757 2. [log.js][4]
758 3. [socket.io][5]
759 4. [node-rlog][6]
760 5. [BigBrother][7]
761 6. [Loggly][8]
64b82cb @indexzero [doc api] Added to README.md. Started file transport.
indexzero authored
762
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and indexabl...
indexzero authored
763 ## Installation
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
764
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and indexabl...
indexzero authored
765 ### Installing npm (node package manager)
766 ```
767 curl http://npmjs.org/install.sh | sh
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
768 ```
20698a9 @indexzero [api test doc] Small updates to docs. Make instances of transports on lo...
indexzero authored
769
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and indexabl...
indexzero authored
770 ### Installing winston
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
771 ```
fd1b41c @indexzero [doc] Began refactoring README.md to be more human readable and indexabl...
indexzero authored
772 [sudo] npm install winston
773 ```
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
774
20698a9 @indexzero [api test doc] Small updates to docs. Make instances of transports on lo...
indexzero authored
775 ## Run Tests
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
776 All of the winston tests are written in [vows][9], and designed to be run with npm.
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
777
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
778 ``` bash
779 $ npm test
5d584fb @indexzero [doc] Update README.md for 0.2.9
indexzero authored
780 ```
20698a9 @indexzero [api test doc] Small updates to docs. Make instances of transports on lo...
indexzero authored
781
782 #### Author: [Charlie Robbins](http://twitter.com/indexzero)
0d09b41 @indexzero [doc] Added Marak as a contributor
indexzero authored
783 #### Contributors: [Matthew Bergman](http://github.com/fotoverite), [Marak Squires](http://github.com/marak)
b18dad9 @indexzero [doc] Updated README.md
indexzero authored
784
b71dd66 @indexzero [api doc] Large additions to README.md. Accept pass-through level argume...
indexzero authored
785 [0]: https://github.com/isaacs/npm/blob/master/lib/utils/log.js
786 [1]: http://nodejs.org/docs/v0.3.5/api/events.html#events.EventEmitter
fed175b @indexzero [doc] Continued updating documentation
indexzero authored
787 [2]: http://github.com/nodejitsu/require-analyzer
788 [3]: http://nodejitsu.com
789 [4]: https://github.com/visionmedia/log.js
790 [5]: http://socket.io
791 [6]: https://github.com/jbrisbin/node-rlog
792 [7]: https://github.com/feisty/BigBrother
793 [8]: http://loggly.com
794 [9]: http://vowsjs.org
Something went wrong with that request. Please try again.